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