本文介绍了c#生成的csv文件通过嵌入到电子邮件底部的电子邮件在莲花注释中发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个weired问题,通过电子邮件使用.NET SmtpClient发送的CSV附件出现在电子邮件的底部,而不是Lotus Notes中的附件。我只是不知道如何计算出来,我没有访问客户端电脑使调试非常困难。
I am having this weired issue that CSV attachment sent via email using .NET SmtpClient appeared at the bottom of the email rather than attachment in Lotus Note. I just don’t know how to figure it out and I have no access to client computer makes debugging very hard. What are the possible steps I can take and possible gotchas I need to be aware of?
代码如下:
var smtpClient = new SmtpClient
{
Host = ConfigurationManager.AppSettings["smtpServer"],
Port = Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"])
};
var mailMessage = new MailMessage();
mailMessage.Attachments.Add(new Attachment(attachment, contentType));
//ContentType = "text/csv";
//attachment is the temp file disk path
$ b
推荐答案
这是一个有点可及,但你可能想设置附件的内容处置。
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);
改编自:
这篇关于c#生成的csv文件通过嵌入到电子邮件底部的电子邮件在莲花注释中发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!