How to solve this SMTP Error problem? When I'm sending mail I'm facing this error message. Sending mail using local system is not a problem. Does anyone know the solution to this problem?
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at admin_booking.btninvoicemail_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\starlineroadways.com\httpdocs\admin_booking.aspx.cs:line 596 code:
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential("xx@gmail.com", "xx");
System.Net.Mail.MailMessage oMsg = new System.Net.Mail.MailMessage();
MailAddress @add = new MailAddress(txtsendemail.Text);
oMsg.From = new MailAddress("xx");
oMsg.To.Add(@add);
oMsg.Subject = "xxx";
oMsg.Body = msgbody2;
oMsg.IsBodyHtml = true;
smtp.Send(oMsg);