Sending Mail via SMTP in C# using BCC without TO

2019-06-15 20:52发布

I am trying to use the System.Net.Mail.MailMessage class in C# to create an email that is sent to a list of email addresses all via BCC. I do not want to include a TO address, but it seems that I must because I get an exception if I use an empty string for the TO address in the MailMessage constructor. The error states:

ArgumentException
The parameter 'addresses' cannot be an empty string.
Parameter name: addresses

Surely it is possible to send an email using only BCC as this is not a limitation of SMTP.

Is there a way around this?

标签: c# email smtp bcc
8条回答
孤傲高冷的网名
2楼-- · 2019-06-15 21:40

It doesn't even need to be a real e-mail address, I typically use Mailer@CompanyName.com for TO, and NoReply@CompanyName for FROM.

查看更多
太酷不给撩
3楼-- · 2019-06-15 21:40

Just don't call the Add-method on the To-property.

查看更多
登录 后发表回答