隐藏多个收件人,并使用mailMessage仅显示收件人电子邮件ID

时间:2021-07-20 21:53:20

I want to send email to multiple recipients , but when the user receives the mail he should see only "his" email id in the "to" field.

我想向多个收件人发送电子邮件,但是当用户收到邮件时,他应该只在“收件人”字段中看到“他的”电子邮件ID。

Below is the code.

以下是代码。

for (int i = 0; i < recipients.Length; i++)
{
  emailMessage.To.Add(recipients[i]);
  TheSMTPClient.Send(@emailMessage);                    
}

Using the above code, all the email id will be listed in "to" field. I guess BCC is not the solution as it has 1 constant id in to field and rest in BCC.

使用上面的代码,所有电子邮件ID都将列在“收件人”字段中。我猜BCC不是解决方案,因为它在字段中有1个常量id并且在BCC中休息。

2 个解决方案

#1


0  

What about ?

关于什么 ?

for (int i = 0; i < recipients.Length; i++)
{
  emailmessage.To.Clear();
  emailMessage.To.Add(recipients[i]);
  TheSMTPClient.Send(@emailMessage);                    
}

#2


0  

The solution that worked for me is :

对我有用的解决方案是:

 for (int i = 0; i < recipients.Length; i++)
                    {
                            MailMessage emailMessage = new MailMessage("sendr@gmail.com", recipients[i],
                                "Notice", msg);
                            TheSMTPClient.Send(@emailMessage);
                    }

#1


0  

What about ?

关于什么 ?

for (int i = 0; i < recipients.Length; i++)
{
  emailmessage.To.Clear();
  emailMessage.To.Add(recipients[i]);
  TheSMTPClient.Send(@emailMessage);                    
}

#2


0  

The solution that worked for me is :

对我有用的解决方案是:

 for (int i = 0; i < recipients.Length; i++)
                    {
                            MailMessage emailMessage = new MailMessage("sendr@gmail.com", recipients[i],
                                "Notice", msg);
                            TheSMTPClient.Send(@emailMessage);
                    }