将电子邮件地址添加到System.Net.MailMessage.To集合(+)

编程入门 行业动态 更新时间:2024-10-10 23:22:41
本文介绍了将电子邮件地址添加到System.Net.MailMessage.To集合(+)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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 2@2", 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集合(+)

本文发布于:2023-11-09 04:08:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571363.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电子邮件地址   System   MailMessage   Net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!