Jim Geurts
Jim Geurts

Reputation: 20419

How to support international characters with IIS SMTP

We're experiencing errors when someone tries to send an email using non-English characters (á é ñ). Is there a specific configuration that needs to be made on the SMTP server or in code?

This is the error that we're getting:

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)

Upvotes: 0

Views: 1337

Answers (2)

tom
tom

Reputation: 91

In .Net4, the MailAddress class has accepted non-ascii characters.

You may also need to set SmtpDeliveryFormat to SmtpDeliveryFormat.International.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1499800

That looks like they're trying to send to/from an address with non-English characters in.

As far as I can tell, RFC 2822 only supports ASCII within email addresses.

Upvotes: 1

Related Questions