8
将文件从MemoryStream附加到C#中的MailMessage
我正在编写一个程序将文件附加到电子邮件。目前,我正在将使用的文件保存FileStream到磁盘中,然后使用 System.Net.Mail.MailMessage.Attachments.Add( new System.Net.Mail.Attachment("file name")); 我不想将文件存储在磁盘中,我想将文件存储在内存中,然后从内存流中将其传递给Attachment。
113
c#
email
smtp
memorystream