3

How do I send an email with accented letters? Example is pepé@lefrenchplace.com, which should be supported now with RFC 6532

If I send an email to pepé@lefrenchplace.com from gmail's web interface, it is delivered no problem.

I'm using .NET 4.6.1, C#, and SendGrid.

First attempt with SMTP:

var smtp = new SmtpClient(Server)
{
    Credentials = new NetworkCredential(Username, ApiKey),
    DeliveryFormat = SmtpDeliveryFormat.International
};

var message = new MailMessage(From, To)
{
    Subject = Subjet,
    Body = BodyPlainText
};

smtp.Send(message);

This throws an SmtpException with the message The client or server is only configured for E-mail addresses with ASCII local-parts: pepé@lefrenchplace.com.

Second attempt API V3 with SendGrid C# library

var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
var client = new SendGridClient(apiKey);
var from = new EmailAddress("test@example.com", "Example User");
var subject = "Sending with SendGrid is Fun";
var to = new EmailAddress("pepé@lefrenchplace.com", "Example User");
var plainTextContent = "and easy to do anywhere, even with C#";
var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
var response = await client.SendEmailAsync(msg);

I get an Accepted status code returned. On the SendGrid dashboard it shows as Dropped with Invalid as the reason.

Community
  • 1
  • 1
Th4t Guy
  • 1,442
  • 3
  • 16
  • 28
  • does the server return SMTPUTF8 in its EHLO message: https://stackoverflow.com/a/36375833/578411 – rene Jan 15 '18 at 21:29
  • @rene It does not return SMTPUTF8 from EHLO. So.. option 1 is out. Would option 2 possibly work some how? – Th4t Guy Jan 15 '18 at 22:36
  • perhaps it could digest the address if you converted it to IDN, [have a look](https://stackoverflow.com/a/4101202/1132334) – Cee McSharpface Jan 15 '18 at 23:28
  • @dlatikay No luck. Converts to `xn--peplepew@lefrenchplace-d8b.com`. No SMTP exception though, just doesnt get sent to my inbox. – Th4t Guy Jan 16 '18 at 00:13

1 Answers1

4

Edit August 2020

SendGrid has closed the Github issue. Anybody wanting a standards compliant email provider to send to an internationalized email address should look elsewhere. Mailgun would work


As of right now, SendGrid does not support E-mail addresses with non-ASCII local-parts at all.

They told me it is on their radar but have no time commitment for implementation.

Github issue

Th4t Guy
  • 1,442
  • 3
  • 16
  • 28