Why does System.Net.Mail receive an “authentication failure” but System.Web.Mail does not?

I am sending an email from an asp.net application through a third-party SMTP server. This server requires authentication. Typically, I would use System.Net.Mail in combination with System.Net.NetworkCredential for this.

In this particular case, I always get a message about the lack of authentication. I know that the host name, username and password are correct; I successfully sent messages through Outlook.

Finally, I resorted to using System.Web.Mail to send a message and used System.Web.Mail.MailMessage.Fields.Add to specify credentials.

Looking at the transfers in Wireshark, I noticed a slight difference in the original AUTH command. Both Outlook and System.Web.Mail send "AUTH LOGIN", where System.Net.Mail sends "AUTH LOGIN bWFpba ==".

After a short search, I found that other problems are similar, but usually the fix is ​​to use an intermediate relay server. I thought I would pose a question here to find out if anyone has any ideas.

+3
source share
1 answer

, System.Net.Mail - , System.Web.Mail - . , , ? , , NetworkCredential , Hashed Encrypted , , , .

+1

Source: https://habr.com/ru/post/1785986/


All Articles