[英]System.Net.Mail.MailAddress does not allow Gmail GROUP contact
I am using a Gmail business account, say noreply@mycompany.com
to send a daily email reports to a few of my clients whose email addresses are from different domains. 我正在使用Gmail商家帐户,例如noreply@mycompany.com
,将每日电子邮件报告发送给我的一些客户,这些客户的电子邮件地址来自不同的域。 I use C# to send my email to Gmail's SMTP server. 我使用C#将我的电子邮件发送到Gmail的SMTP服务器。
var receiver = new MailAddress("receiver@domain1.com");
var receiver = new MailAddress("receiver@domain2.com");
var receiver = new MailAddress("receiver@domain3.com");
After a while I found out I had to modify code every time a new customer demands email report. 过了一会儿,我发现每次新客户要求电子邮件报告时我都必须修改代码。 So I want to make a group and maintain that group. 所以我想成立一个小组并维持这个小组。 Gmail has a Add Group settings in your account's "Contacts" page so I used that to create a group named ReportGroup and added those people. Gmail在您的帐户的“通讯录”页面中有一个添加组设置,因此我使用该设置创建了一个名为ReportGroup的组并添加了这些人。 And in the code, this lines throws exception: 在代码中,这行抛出异常:
var receiver = new MailAddress("ReportGroup");
saying The specified string is not in the form required for an e-mail address.
say The specified string is not in the form required for an e-mail address.
Well apparently this isn't a legit email address. 显然这不是一个合法的电子邮件地址。 Is there a way I can bypass this format check? 有没有办法绕过这种格式检查? Or is it doesn't make sense to do so? 或者这样做没有意义?
In further attempts, I tried to name my group as reportgroup@mycompany.com
. 在进一步尝试中,我尝试将我的组命名为reportgroup@mycompany.com
。 This time the email got sent without complain however the gmail server rejects the receiver, claiming that 这次电子邮件没有抱怨就发送了,但是gmail服务器拒绝了接收者,声称这样
50-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 https://support.google.com/mail/answer/6596 ai2si23882633pad.98 - gsmtp
So this isn't the way to go either. 所以这不是要走的路。 Could any one suggest a solution for me to allow someone non-programmer to maintain an receiver list to which my code sends report to? 任何人都可以建议我允许某个非程序员维护我的代码发送到的接收者列表的解决方案吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.