将电子邮件地址添加到System.Net.MailMessage.To集合(+) [英] Adding e-mail addresses to System.Net.MailMessage.To collection (+)

查看:174
本文介绍了将电子邮件地址添加到System.Net.MailMessage.To集合(+)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能会弄错,但是尽管MSDN说,MailAddressCollection.Add(字符串地址)可用于设置地址 es ,但它不希望收到字符串之类的那个"1@1.com 2@2.com" ;,抛出一条带有消息的例外:

I might be mistaken, but in spite of MSDN saying, that MailAddressCollection.Add(string addresses) can be used to set addresses, it doesn't want to recieve string like that "1@1.com 2@2.com", throwing an exception with the message:

"传递的字符串格式不正确的电子邮件地址",或类似的东西。

"The passed string is not in correct format of e-mail address", or something like that.

所以问题是 - 是否可以通过.Add(字符串地址)方法将多个电子邮件地址添加到MailAddressCollection中?

So the question is - is it somehow possible to add several e-mail addresses into MailAddressCollection via .Add(string addresses) method?

或者是msdn或bcl中的错误...

Or is it a bug whether in msdn or bcl...

推荐答案

如果您尝试添加多个地址只需调用一次MailAddressCollection.Add方法,我假设您必须使用分号(;)

If you try to add more than one address with a single call to the MailAddressCollection.Add method, I assume you will have to seperate the email adresses with a semicolon ( ; )

Sven



这篇关于将电子邮件地址添加到System.Net.MailMessage.To集合(+)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆