SmtpException:客户端或服务器只配置了电子邮件地址与ASCII本地零部件 [英] SmtpException: The client or server is only configured for e-mail addresses with ASCII local-parts
问题描述
href="http://msdn.microsoft.com/en-us/library/swas0fwc.aspx"> SmtpClient.Send()的方法是,当我尝试发送抛出这个异常的
The SmtpClient.Send() method is throwing this exception when I try to send an email to an address containing an accentuated character (é):
System.Net.Mail.SmtpException:客户端或服务器仅配置
电子邮件地址与ASCII本地部分。léo.xxx@xxx.com
在System.Net.Mail.MailAddress.GetAddress(布尔allowUni code)
在System.Net.Mail.SmtpClient.ValidateUni codeRequirement(MailMessage ...)
在System.Net.Mail.SmtpClient.Send(MailMessage消息)
System.Net.Mail.SmtpException: The client or server is only configured for e-mail addresses with ASCII local-parts: léo.xxx@xxx.com.
at System.Net.Mail.MailAddress.GetAddress(Boolean allowUnicode)
at System.Net.Mail.SmtpClient.ValidateUnicodeRequirement(MailMessage...)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
消息的配方使我的事情有可能是我可以激活,使这项工作,虽然我还没有发现关于这个问题的任何设置。
The formulation of the message makes me thing there might be a setting that I can activate to make this work, though I haven't found anything on this subject.
我尝试了好几种SMTP服务器,包括Gmail。下面是相关位的摄制:
I have tried several SMTP servers, including Gmail. Here are the relevant bits for a repro:
code
var msg = new MailMessage();
msg.Subject = "Test";
msg.From = new MailAddress("xxx@gmail.com");
msg.To.Add(new MailAddress("léo.yyy@gmail.com"));
new SmtpClient().Send(msg);
的app.config
<system.net>
<mailSettings>
<smtp from="xxx@gmail.com">
<network host="smtp.gmail.com" port="587" userName="xxx@gmail.com" password="password" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
将为AP preciate任何指针。谢谢你。
Would appreciate any pointers. Thanks.
推荐答案
.NET仅支持ASCII字符。我不相信它支持扩展ASCII字符(包括重音E在的问题)。
.net only supports ASCII characters. I don't believe it supports extended ASCII characters (which includes the accented e in question).
我们遇到了同样的问题与用户试图使用丹麦字符A / E。
We ran into the same issues with users trying to use the danish character for a / e.
这篇关于SmtpException:客户端或服务器只配置了电子邮件地址与ASCII本地零部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!