Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Email is not being sending?

$
0
0

Hi all,

i use to get error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. nj9sm25493816pbc.13 - gsmtp


when i use to click on submit button ,i am trying to send email plz help ?

Code behind:

MailMessage mail = new MailMessage();
mail.From = new MailAddress("jimitbhatt92@gmail.com","Jimit");
mail.To.Add(new MailAddress(TextBox7.Text));
mail.Subject = "Registration";
mail.Body = "Thanks for registration!";
mail.IsBodyHtml = true;

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential("jimitbhatt92@gmail.com", "*********");

try
{
smtp.Send(mail);

}
catch (SqlException)
{

Label1.Text = "Mail has not been sent";

}

web config:

<system.net>
<mailSettings>
<smtp from="jimitbhatt92@gmail.com">
<network host="smtp.gmail.com" userName="jimitbhatt92@gmail.com" password="*******" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>