我正在尝试将视频剪辑 (.avi) 附加到电子邮件中。.NET Framework 4.0 中有没有办法做到这一点?
我的逻辑是我需要在某种文件流中打开该 avi,然后将该流附加到电子邮件并发送出去。我正在努力的部分是从文件中获取流。
试试这个在 .NET 中添加附件的标准方法
MailMessage nMsg = new MailMessage();
nMsg.From = new MailAddress(fromAddress);
nMsg.Subject = subject;
Attachment attachFile = new Attachment("Your file path here");
nMsg.Attachments.Add(attachFile);
SmtpClient mailer = new SmtpClient("yousmtpserver");
mailer.Send(nMsg);