How to use email addresses with special characters such as Ø

By writing this:

var recipient = new MailAddress("name@abcø.dk");

Note the "ø" in the domain part.

I get an exception message:

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

The address used must be absolutely correct.

So, I assume that I need to encode the address somehow?

+3
3

RFC-822 , ASCII, . .

, , , RFC-822, ASCII .

+6

, . . , IDNA

+3

RFC 1034

Labels must comply with ARPANET hostname rules. They should start with a letter, end with a letter or number, and also have interior symbols with only letters, numbers, and hyphens. There are also some length restrictions. Labels must be 63 characters or less.

0
source

Source: https://habr.com/ru/post/1749184/


All Articles