Since Google discontinued the Less secure apps feature and made is more difficult to send e-mail using their smtp server, I've migrated over to another provider.
Now I'm getting The STMP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication required.
This code was working well with Gmail's outgoing SMTP but my new server is complaining. I've tried several code variations and the result is the same.
private void SendEmail()
{
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient("smtp-relay.sendinblue.com");
message.From = new MailAddress("winrest_mail_service@winrest32.com");
message.To.Add("sales@abspos.com");
message.Subject = "NEW LICENCE REQUEST FROM " + ((User) this.Session["User"]).Name;
message.Body = "LICENCE DEATIL" + Environment.NewLine + "SELLER = " + ((User) this.Session["User"]).Name + Environment.NewLine + "ID = " + this.TextBox__id.Text + Environment.NewLine + "NAME = " + this.TextBox__register_nam.Text + Environment.NewLine + "ADDRESS = " + this.TextBox__address.Text + Environment.NewLine + "LIC = " + this.TextBox__licence.Text + Environment.NewLine + "PDA = " + this.TextBox__pda.Text + Environment.NewLine + "CONTACT = " + this.TextBox__contact.Text + Environment.NewLine + "PHONE = " + this.TextBox__phone.Text + Environment.NewLine + "EMAIL = " + this.TextBox__email.Text + Environment.NewLine + "EXP = " + this.Calendar.SelectedDate.ToShortDateString() + Environment.NewLine + "AD SCREEN = " + this.CheckBox__AdScreen.Checked.ToString() + Environment.NewLine + "Biometrics = " + this.CheckBox__Biometrics.Checked.ToString() + Environment.NewLine + "Debit = " + this.CheckBox__Debit.Checked.ToString() + Environment.NewLine + "Draft = " + this.CheckBox__DraftControl.Checked.ToString() + Environment.NewLine + "KitchenScreen = " + this.CheckBox__KitchenScreen.Checked.ToString() + Environment.NewLine + "LiquorControl = " + this.CheckBox__LiquorControl.Checked.ToString() + Environment.NewLine + "WinAuthorize = " + this.CheckBox__WinAuthorize.Checked.ToString() + Environment.NewLine + "Lite = " + this.CheckBox__Lite.Checked.ToString() + Environment.NewLine + "CashNoBill = " + this.CheckBox__DisableCashNoBill.Checked.ToString();
smtpClient.Port = 587;
smtpClient.Credentials = (ICredentialsByHost) new NetworkCredential("mike@notrealcredentials.com", "XSnfc213213216");
smtpClient.EnableSsl = true;
smtpClient.Send(message);
}
Credentials have been altered for privacy reasons.