Hello Guys,
i am having problem while writing codes to implement mail messeging in asp .net with c#
i am using following code
try{
using (MailMessage mm = new MailMessage(txtEmail.Text, txtTo.Text))
{
mm.Subject = txtSubject.Text;
mm.Body = txtBody.Text;
if (fuAttachment.HasFile)
{
string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
mm.Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
}
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential(txtEmail.Text, txtPassword.Text);
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
}
}
catch(Exception ex)
{
Response.Write("");
}
The error i am facing is
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. ra13sm19230672pac.29 - gsmtp

Rajeesh MenothPosted Oct 21, 2016, 4:52 AM
Ananth GPosted Oct 21, 2016, 12:59 AM
Bikesh SrivastavaPosted Oct 6, 2016, 6:35 AM
Midhun TpPosted Oct 6, 2016, 5:31 AM
Ankit KumarPosted Oct 6, 2016, 4:40 AM
Midhun TpPosted Oct 6, 2016, 4:18 AM