Click here to Skip to main content
15,938,446 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
msg.Subject = subject;
msg.Body = "<html><body>" + "

Name :" + context.Request["Name"] + "

" + "

Email :" + context.Request["email"] + "

Message :" + context.Request["message"];
//the from email address to be provided here with the From name to be displayed
msg.From = new System.Net.Mail.MailAddress("hello@domain.in", "domain enquiry");
//To which mail box the mail has to be sent.

msg.To.Add("hello@domain.in");
msg.IsBodyHtml = true;

smtp.Host = "smtp.gmail.com";
// The email credentials to be provided here.
System.Net.NetworkCredential basicauthenticationinfo = new System.Net.NetworkCredential("hello@domain.in", "password");
//Port Number
smtp.Port = 587;

smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = basicauthenticationinfo;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

smtp.Send(msg);
can any one help me to get rid of this exception

Posted
Comments
Richard MacCutchan 24-Feb-14 12:13pm    
The from address in your message must be a valid gmail user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900