public voID Esendmail(string EmailFrom,string EmailTo,string EmailBody,string EmailSubject,string EmailCC){ MailMessage message = new MailMessage(); message.From = new MailAddress(EmailFrom); message.CC.Add(EmailCC); message.To.Add(new MailAddress(EmailTo)); message.IsBodyHTML = true; message.Body = EmailBody; message.Subject = EmailSubject; SmtpClIEnt clIEnt = new SmtpClIEnt(); clIEnt.Send(message); }解决方法 使用此示例代码
MailMessage message = new MailMessage();message.To = "abc@domain.com";message.From = "xyz@domain.com";message.Subject = "mail with pdf";message.Body = "your pdf attached";message.Attachments.Add(new Attachment(@"c:\pdftoattach.pdf"));SmtpMail.SmtpServer = "mail.domain.com";SmtpMail.Send(message);总结
以上是内存溢出为你收集整理的c# – 如何将pdf文件添加为电子邮件的附件全部内容,希望文章能够帮你解决c# – 如何将pdf文件添加为电子邮件的附件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)