954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Send Email Through Gmail In C#

I want some help in sending Email through my Gmail account. I don't want this for spamming purpose. I am developing Complaint System for my University and I want to send Email whenever any Complaint is launched. I already tried the following code but I am getting "Failure Sending Email" error.

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("myEmail", "destinationEmail");

mail.Subject = "New Complaint Registration";

mail.Body = "";

mail.IsBodyHtml = true;

SmtpClient client = new SmtpClient("smtp.gmail.com");

NetworkCredential cred = new NetworkCredential("myEmail", "myPassword");

client.EnableSsl = true;

client.Credentials = cred; 

try
{
   client.Send(mail);
}
catch (Exception)
{
}
rt.garg1991
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

hi...try this link it gives the details about sending mail using gmail account [snipped blog spam link]

vforvijay
Newbie Poster
8 posts since Feb 2011
Reputation Points: 3
Solved Threads: 2
 

Thankx for replying vforvijay, but the link you have posted is of no use. Because the target web-page has the similar code that i had posted in my problem and this code is not working for me. :(

rt.garg1991
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: