I’ve just implemented some code that emails a bunch of our clients with a CSV file attachment.
Some (not many) have got back to us complaining that they don’t get an attachment at all – just the CSV text inside the body of the email. Most however are fine.
I suspect that it’s different mail clients that are treating the attachment differently but I don’t have enough info yet to be sure.
I’m using .NET’s MailMessage class with the Attachment.CreateAttachmentFromString() method. The MIME type I’m specifying for the attachment is text/csv.
Anyone have any idea what the heck is going on?
Ta muchly
David
Another possibility is that the failing email clients do not recognize the MIME type ‘text/csv’ and thus are showing the content uninterpretted in-line — it may actually go through better as ‘text/plain’.
Edit: I just sent a test message with a CSV attachment from Outlook to my Gmail, and used the menu option “Show original” to see the actual multi-part content, and this is what I see:
So it looks like ‘application/octet-stream’ will do the trick.