I try to send mail using C# and yandex, but I get an error:
Error 5.5.4 Error: send AUTH command first
Here is my code. I try w
You must set sc.Credentials = new System.Net.NetworkCredential() after calling sc.UseDefaultCredentials = false;
UseDefaultCredentials = false will reset Credentials to null
try to switch lines order to:
sc.UseDefaultCredentials = false;
sc.Credentials = new System.Net.NetworkCredential(System.Configuration.ConfigurationManager.AppSettings["Email"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["Sifre"].ToString());
also valid settings for smtp.yandex.ru:
smtpUserName=""
enableSsl="true"
smtpPassword=""
smtpAuthentication="Basic"
smtpServer="smtp.yandex.ru"
smtpPort="465"