|
-
June 22nd, 2009, 05:49 AM
#1
Unable to send email using SmtpClient
I have written the following code for sending Email. I have used my Gmail username and password for Network credentials.
string strEmailID ; //It is some valid Email ID.
MailMessage mail = new MailMessage("[email protected]", strEmailID);
mail.Subject = "New Reimbursement added";
mail.Body = "Test";
SmtpClient client = new SmtpClient();
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.Credentials = new NetworkCredential(username, password);
client.Send(mail);
But this doesn't work for all systems. In some systems, it is successfully sending mail, but in some systems, it is throwing an exception.
Can any one help me regarding this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|