Adding Bcc to Email sending using .NET SmtpClient?

最后都变了- 提交于 2019-12-08 14:45:48

问题


When sending email using the SMTPClient class in ASP.NET C#, how can I add bcc to the email? How can I add bcc to a MailMessage instance?


回答1:


MailAddress addressTo = new MailAddress("to@someone.com");
MailAddress addressFrom = new MailAddress("from@someone.com");
MailAddress addressBCC = new MailAddress("bcc@someone.com");

MailMessage MyMessage = new MailMessage(addressFrom, addressTo );
MyMessage.Bcc.Add(addressBCC);



回答2:


You're looking for the aptly-named Bcc property:

message.Bcc.Add("You@Example.com");



回答3:


Here i will explain how to send email with cc and bcc using asp.net c# application.

 MailMessage mailMessage = new MailMessage(smtpUser, toAddress);
 if (!string.IsNullOrEmpty(cc))
 {
    mailMessage.CC.Add(cc);
 }
 if (!string.IsNullOrEmpty(bcc))
 {
    mailMessage.Bcc.Add(bcc);
 }

For full example http://www.stepover-f10.com/2014/01/how-send-email-with-cc-and-bcc-with-authentication-using-aspnet-csharp-example-source-code.aspx click this link.



来源:https://stackoverflow.com/questions/2474472/adding-bcc-to-email-sending-using-net-smtpclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!