views:

54

answers:

4

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. u6sm344516ibd.6

I have my code like this?

MailAddress to = new MailAddress("[email protected]");
MailAddress from = new MailAddress("[email protected]");
MailMessage message = new MailMessage(from, to);
message.Subject = "Error Occred in the application:";
message.Body = ex.Message;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
+4  A: 

the SMTP server required that you use a secure connection

client.EnableSsl = true;
Stefanvds
I am getting the Same Error again? sir thanks
kumar
Stefanvds
+2  A: 

You could check if setting the EnableSsl property for SmtpClient to true and specifying the credentials would help.

client.EnableSsl = true;
client.Credentials = new NetworkCredential("user", "password");
andrei m
its still saying the same thing? sir
kumar
do I need to provide Credential must and should? thanks if i use port number 467 what will happen?
kumar
I receive the following error if EnableSsl is set to true and credentials are not provided "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required..."
andrei m
Thanks Abatishchev.. but its giving this error when I am trying to send to hotmailDelivery to the following recipient failed permanently: [email protected] details of permanent failure:Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 Requested action not taken: mailbox unavailable (state 14).
kumar
andrei m
+2  A: 

You will need to set the appropriate properties of the SmtpClient instance to enable TSL/SSL, and set credentials. Check out this for more:

http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx

Andrew Barber
+1  A: 

Try configuring your SMTP to use port 25 (with SSL).

Pavithra Jayakumar
If i use port 25 do I need to use the credentials?
kumar
yes.. we need to pass the credentials.. and enable SSL..
Pavithra Jayakumar