I'm having issues sending an email using Yandex.
"SmtpException: Bad sequence of commands. The server response was: 5.5.4 Error: send AUTH command first."
I've tried all the solutions from: C# yandex mail send error 5.5.4 Error: send AUTH command first
Solutions I've tried:
- EnableSsl to true
 - Changing smtpHost (tried smtp.yandex.com, smtp.yandex.ru, smtp.yandex.com.tr)
 - Changing smtpPort (tried 587, 25) (465 doesn't work as SSL deprecated)
 - Checked correct password is being used
 - Made sure "UseDefaultCredentials = false" is before the credentials being set
 - Tried adding in "SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;"
 
This is pretty much everything accepted in the above question, however not one solution has worked for me.
Email Sender Class
        SmtpClient client = new SmtpClient();
        client.UseDefaultCredentials = false;
        client.Credentials = new NetworkCredential($"{Configuration["EmailSettings:UserName"]}", $"{Configuration["EmailSettings:Password"]}");
        client.Port = Convert.ToInt32(Configuration["EmailSettings:SmtpPort"]);
        client.Host = Configuration["EmailSettings:SmtpHost"];
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.EnableSsl = true;
        MailMessage mailMessage = new MailMessage();
        mailMessage.From = new MailAddress($"{Configuration["EmailSettings:UserName"]}");
        mailMessage.To.Add("SomebodysEmail");
        mailMessage.Body = "body";
        mailMessage.Subject = "subject";
        client.Send(mailMessage);
appsettings.json
"EmailSettings": {
"SmtpHost": "smtp.yandex.com.tr",
"SmtpPort": "25",
"UserName": "email",
"Password": "password"
},
In case anyone was curious, I've checked the credentials, port and host are being passed through properly from appsettings.json.
Thanks for your assistance!