开发者

Adding Bcc to Email sending using .NET SmtpClient?

开发者 https://www.devze.com 2022-12-23 23:47 出处:网络
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 MailMe开发者_C百科ssage instance?MailAddress addressTo = new MailAddress(\"to@someone

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 MailMe开发者_C百科ssage instance?


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);


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

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消