If you require sending messages to email addresses which contain non-ASCII characters like “äöü”, that’s how it’s done. However, important to determine whether those characters are in domain or username part of email address.
MailBee.Global.LicenseKey = "Trial or permanent key"; Smtp mailer = new Smtp(); mailer.Log.Enabled = true; mailer.Log.Filename = @"C:\Temp\log.txt"; mailer.SmtpServers.Add("mail.domain.com", "jdoe", "secret"); mailer.From.Email = "email@example.com"; mailer.From.DisplayName = "John Doe"; EmailAddress addr = new EmailAddress("jane.doe@äöü.com", "Jane Doe"); mailer.To = addr.ToIdnAddress(); mailer.Subject = "Sending mail to addresses containing non-ASCII characters"; mailer.BodyHtmlText = "This is a sample mail message."; mailer.Send();
It is perfectly 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.
And if those characters are in username, not just in domain name – then you need to set Smtp.RequestEncoding property to UTF8. Bear in mind that many SMTP servers are unable to deal with international email addresses, so you may wish to check if particular SMTP server returns UTF8SMTP or SMTPUTF8 capability in EHLO response.