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 with different ports (587, 465..) and SMTP hosts (smtp.yandex.com.tr, smtp.yandex.com, smtp.yandex.ru...) but I get the same error for all attempts.
SmtpClient sc = new SmtpClient("smtp.yandex.com.tr", 587);
//sc.Port = 587;
//sc.Host = "smtp.yandex.com";
sc.EnableSsl = false;
sc.Credentials = new System.Net.NetworkCredential(System.Configuration.ConfigurationManager.AppSettings["Email"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["Sifre"].ToString());
sc.UseDefaultCredentials = false;
sc.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
Yandex Mail doesn't support connection without SSL (according to https://yandex.com/support/mail/mail-clients.xml). Try to set EnableSsl
to true and use host: smtp.yandex.com
, port: 465. If it will not work - try port 25