0

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)
{
}
2
Contributors
2
Replies
5
Views
6 Years
Discussion Span
Last Post by rt.garg1991
0

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

Edited by Ezzaral: n/a

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.