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)
{
}

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

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. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.