如何使用IIS SMTP支持国际字符

时间:2009-09-15 14:47:44

标签: c# iis smtp

当有人尝试使用非英文字符(áéñ)发送电子邮件时,我们遇到了错误。是否需要在SMTP服务器或代码中进行特定配置?

这是我们得到的错误:

System.FormatException: The specified string is not in the form required for an e-mail address.
  at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)
  at System.Net.Mail.MailAddress.ParseValue(String address)
  at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
  at System.Net.Mail.MailAddress..ctor(String address)

2 个答案:

答案 0 :(得分:1)

看起来他们正在尝试使用非英文字符发送到地址

据我所知,RFC 2822仅支持电子邮件地址中的ASCII。

答案 1 :(得分:0)

在.Net4中,MailAddress类已接受非ascii字符。

您可能还需要将SmtpDeliveryFormat设置为SmtpDeliveryFormat.International。