c# generated csv file sent via email embedded to bottom of email in lotus note

主宰稳场 提交于 2019-12-06 06:50:48

This is a bit of a reach, but you may want to set the content-disposition of the attachment.

var mailMessage = new MailMessage();
Attachment data = new Attachment(attachment, contentType); 
ContentDisposition disposition = data.ContentDisposition;
disposition.FileName = "message.csv";
mailMessage.Attachments.Add(data);

Adapted from: http://msdn.microsoft.com/en-us/library/system.net.mail.attachment.contentdisposition.aspx

In some mail clients there is an option to display attachments inline.

Most obvious test would be to send a .csv file attachment from other sources and see what the results are in the client having the issue.

Try not setting the content type and just setting the extension. Windows should be able to handle that if it has an extension and it may force it to handle it as an attachment instead of attempting to display it inline.

Make sure that your file that you are attaching has an extension.

dave wanta

Just for a test, try setting the content-type to something like "application/octet-stream" . For example (off the top of my head):

ContentType ct = new ContentType( "application/octet-stream" );
ct.Name = "message.csv";
data.ContentType = ct;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!