How to validate smtp credentials before sending mail in C# ?

Posted by Manish Gupta on Stack Overflow See other posts from Stack Overflow or by Manish Gupta
Published on 2010-03-11T15:16:18Z Indexed on 2010/04/29 10:37 UTC
Read the original article Hit count: 410

Filed under:
|
|

I need to validate the username and password set in SmtpClient object before sending mail.

Here is the code sample:

SmtpClient client=new SmtpClient(host);
client.Credentials=new NetworkdCredentials(username,password);
client.UseDefaultCredentials=false;

//Here I need to verify the credentials(i.e. username and password)
client.Send(mail);

Thanks in advance.....

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET