Getting SMTP Server exception

Posted by Kondapallisrinivas under ASP.NET on 9/11/2012 | Points: 10 | Views : 2203 | Status : [Member] | Replies : 2
Hello all

I developed one page which contains

to email:.........
from email:.......
sub:..........
Body:.........

After filling all these when user clicks on the submit button....The mail has been reached to the email id which was given in the to test box ......It is working when we try with our corporate host in our local meachines....But when we place the same code in the server with the host as Gmail...It is trowing some exception like "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at " ...


Please open the url:http://saiemail.somee.com/........so that you get more information about the exception

Please say how i can overcome form this exception

Thanks in advance




Responses

Posted by: Vikash on: 9/11/2012 [Member] Starter | Points: 25

Up
0
Down
i would suggest that please give appropriate password of your email id you are using with.
hope it will work.........

Regards,
Vikash Pathak

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajkatie on: 9/11/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Because Gmail use secure socket layer(SSL). So, before sending mail have to set this property true in your code.

e.g :

var mailClient = new SmtpClient
{
Host = smtp.gmail.com
Port = 587
DeliveryMethod = SmtpDeliveryMethod.Network,
EnableSsl = true,
Credentials = new NetworkCredential(userName, password)
};


Rajesh Patel
.Net Trainer(MSCD | MCT | MS)
Brainbench (Asp.Net 4.5 and C# 5.0)

Kondapallisrinivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response