【问题标题】:Attachments comes only inline附件仅内联
【发布时间】:2014-10-21 14:06:17
【问题描述】:

我将一个文件附加到电子邮件中,并将其设置为像附件一样,但它只是内联的

        Attachment data = new Attachment(filepath);
        data.ContentDisposition.Inline = false;
        data.ContentDisposition.DispositionType = DispositionTypeNames.Attachment;

        // Add time stamp information for the file.
        ContentDisposition disposition = data.ContentDisposition;
        disposition.CreationDate = System.IO.File.GetCreationTime(filepath);
        disposition.ModificationDate = System.IO.File.GetLastWriteTime(filepath);
        disposition.ReadDate = System.IO.File.GetLastAccessTime(filepath);
        disposition.FileName = filename;
        disposition.DispositionType = DispositionTypeNames.Attachment;


        // Add the file attachment to this e-mail message.
        message.Attachments.Add(data);

我做错了什么?

【问题讨论】:

  • 你试过new Attachment(file, MediaTypeNames.Application.Octet);吗?
  • @Reniuz 没有任何变化
  • 附件“内联”到底如何?您是否在指向附件的电子邮件正文中添加 标记?
  • 也就是说,System.Net.Mail 对某些属性有未记录的副作用。尝试输入“data.ContentDisposition.Inline = false;”就在“message.Attachments.Add(data);”之前
  • 这听起来更像是一个电子邮件客户端“有帮助”,而不是您如何配置电子邮件的问题。

标签: c# email attachment email-attachments


【解决方案1】:

我只在 mac Mail 中测试过,现在我在 gmail 中尝试过,附件很好,不符合要求

【讨论】:

  • 是的,看起来 Mac Mail 会自动内联显示 1 页 PDF。
猜你喜欢
  • 1970-01-01
  • 2015-08-01
  • 2017-08-13
  • 2016-12-18
  • 1970-01-01
  • 2015-12-04
  • 2012-02-17
  • 2011-12-19
  • 1970-01-01
相关资源
最近更新 更多