File.WriteString uses a TextWriter to write the string and it then closes the file. The issue is somewhere else.
Probably with the mail app itself.
You can switch to SMTP from the Net library instead. It will allow you to directly send the mail.
Hi Erel,
Thanks for your response, I pretty much thought the WriteString was a wrapper for the textwriter so didn't bother implementing the change. We have experienced the same issues over the weekend, 2 users suffering problems and 2 were fine, all running Samsung Note 10.1 tablets, all same OS version all using the default email client with the same settings, I've been scratching my head with this one for a month now.
Could it be possible that it's something to do with the amount of files in the application cache directory as we store other files in there as part of another module within the application. i.e. when the application attempts to write out the text file, there is not enough space in the cache directory so it has to spend some time deleting files it deems are to be removed in order to free up space? Sorry, I'm clutching at straws I know but I'm at a loss as to which direction to go now?
I'll have a look at the SMTP method but I' would need to speak to our network admin as I'm not sure about possible security implications and access to directly send mail unsing our exchange server as a relay. The preferred method is to use the email client so it's all in the users control.
If you can suggest anything else to look into it would be most appreciated. Is there anyway of constructing the attachment in memoryand attaching it as some form of binary object that's passed to the mail client without having to stream out to a file first as I'm sure the problem surrounds this area.
Many thanks