Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30098

Gmail API: Using mailadress containing umlauts results in SMTPEception: The client or server is only configured for addresses with ASCII local-parts

$
0
0

Trying to send an mail with the gmail api to a mail adress that contains umlauts. e.g. büro@gmail.com. Getting an SmtpException then:

maildress: GeneralFailure: System.Net.Mail.SmtpException: The client or server is only configured for E-mail addresses with ASCII local-parts: büro@gmail.com.
bei System.Net.Mail.MailAddress.GetUser(Boolean allowUnicode)
bei System.Net.Mail.MailAddress.GetAddress(Boolean allowUnicode)
bei System.Net.Mail.MailAddress.GetSmtpAddress(Boolean allowUnicode)
bei System.Net.Mail.SmtpClient.ValidateUnicodeRequirement(MailMessage message, MailAddressCollection recipients, Boolean allowUnicode)
bei System.Net.Mail.SmtpClient.Send(MailMessage message)

I know that when I usethe .net smtp client directly you can set SmtpDeliveryFormat.International to be able to. But how to set it when I use the gmail api?

private GmailService _service;

public void SendMail(MailMessage message)
{
    message.SubjectEncoding = Encoding.UTF8;
    message.BodyEncoding = Encoding.UTF8;
    message.IsBodyHtml = true;

    MimeKit.MimeMessage mimeMessage = MimeKit.MimeMessage.CreateFromMailMessage(message);
    Message sendMmessage = new Message {Raw = Base64UrlEncode(mimeMessage)};

    _service.Users.Messages.Send(sendMmessage, _fromMailAdress).Execute();
}

Since I use a google business account I can't use the SMTPClient directly, because google shut down the usage of less secure apps.


Viewing all articles
Browse latest Browse all 30098

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>