SMTP Client won’t accept umlauts in password

I wrote a smal programm for a client which sends Mails over an outlook server. To identify yourself you have to type in your username (mail-address) and your password. The problem is, that one of the users has an umlaut (ä, ö, ü) in his password and therefore it dosn't work form him. I tested this scenario with my own password and yes, the one with the umlaut didn't work.

So, I use System.Net.Mail with this lines:

var mailClient = new SmtpClient("smtp.office365.com", 587);
mailClient.EnableSsl = true;
mailClient.Credentials = new System.Net.NetworkCredential("username", "passwordWithUmlaut");
mailClient.Send(Email);

As said before, when the password has no umlaut it works perfectly fine but with the umlaut it dosn't accept the mail.

The Error which is thrown, states out that a "secure connection is needed" but ssl is activated. Furthermore it says, that "the client could not be autheticated. The serverresponse was: 5.7.57 Client not authenticated to send mail. [PR0P264CA0263.FRAP264.PROD.OUTLOOK.COM]"

Does anyone knows how to make it work with umlauts, or is this a common problem I have to live with.



Read more here: https://stackoverflow.com/questions/67932889/smtp-client-wont-accept-umlauts-in-password

Content Attribution

This content was originally published by Prophet at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: