EmailAddressToIdnAddress Method |
Namespace: MailBee.Mime
If you have an e-mail address which may potentially have international characters in the domain part, you should call this method to make this address safe for SMTP servers and use the resulting object instead of the original EmailAddress object.
It's safe to use this method for addresses which don't contain any international characters, you'll just get the new object which has the same values as the current one (it will still be a new EmailAddress object, not a reference to the original EmailAddress object).
In case if you have just an e-mail address string, not an EmailAddress object, you can use EscapeIdnDomain(String) method instead.
Note |
---|
Punycode works for domain part only. If you want to send to an e-mail address having international chars in username (not just in domain), you need to set RequestEncoding property to UTF8. Still no guarantee this will work as many SMTP servers can't deal with international characters in an e-mail address. When they support this, they usually expose UTF8SMTP or SMTPUTF8 capability in EHLO response. |