简体   繁体   English

C#电子邮件BCC显示错误的收件人电子邮件地址

[英]C# Email BCC displaying wrong recipient email address.

I'm having a strange problem with BCC. 我对BCC有一个奇怪的问题。 The recipients receiving the messages, but in the To: field having the to email address. 接收邮件的收件人,但在收件人:字段中具有到电子邮件地址。 So for example bcc1@server.com recipient getting the right message in the right mailbox but To: field instead of has to@server.com instead of bcc1@server.com. 因此,例如bcc1@server.com收件人在正确的邮箱中收到正确的邮件但收件人:字段而不是to@server.com而不是bcc1@server.com。 Same thing with the bcc2. 与bcc2相同。 Anybody can see a problem? 有谁能看到问题? What did I do wrong? 我做错了什么?

MailAddress from = new MailAddress("from@server.com", "Ben Miller");
MailAddress to = new MailAddress("to@server.com", "Jane Clayton");
MailMessage message = new MailMessage(from, to);
message.Subject = "Test Subject.";
message.IsBodyHtml = true;
message.Body = "Some body text";
MailAddress bcc1 = new MailAddress("bcc1@server.com", "BCC1 Reciever");
message.Bcc.Add(bcc1);
MailAddress bcc2 = new MailAddress("bcc2@server.com", "BCC2 Reciever");
message.Bcc.Add(bcc2);


SmtpClient client = new SmtpClient(server);
System.Net.NetworkCredential SMTPUserInfo = new           System.Net.NetworkCredential("from@server.com", "pass");
client.UseDefaultCredentials = true;
client.Credentials = SMTPUserInfo;

client.Send(message);

As per the Remarks from MSDN on MailMessage.Bcc property looks like its working correctly 根据MSDN对MailMessage.Bcc属性的说明看起来它的工作正常

Remarks on MSDN : To add a BCC recipient to an e-mail message, create a MailAddress for the recipient's address, and then add that object to the collection returned by the Bcc property. MSDN上的备注:要将BCC收件人添加到电子邮件中,请为收件人的地址创建MailAddress,然后将该对象添加到Bcc属性返回的集合中。

When recipients view an e-mail message, the Bcc addresses are usually not displayed. 当收件人查看电子邮件时,通常不会显示密件抄送地址。

MailMessage.Bcc MailMessage.Bcc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM