kannan

kannan

  • NA
  • 47
  • 0

SmptClient is not working...

Dec 21 2009 6:12 AM

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. 21sm5152578pzk.3
System.Net.Mail.MailMessage mymail = new System.Net.Mail.MailMessage("fromAddress", "Toaddress");
            mymail.Body = "message body";
            mymail.Subject = "message subject";
            System.Net.Mail.SmtpClient mysmtpclient = new System.Net.Mail.SmtpClient("smtp.gmail.com.",587);
            mysmtpclient.EnableSSL= true;
            mysmtpclient.UseDefaultCredentials = false;
            mysmtpclient.Credentials = new System.Net.NetworkCredential("gmail id", "gmail password");
           
            mysmtpclient.Send(mm);
I got the exception
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. 21sm5152578pzk.3
            Even i had changed the port number to 465, it wont work. But using chilkat smtpclient it is working. How can i overcome this? Please help me!

Answers (2)