In creating my program, I put a Form so that you can use it to "Report Error / Suggestions". In this form I put 2 textbox and 1 button . 1 textbox to Subject , and the other to write what you want (message).
The button
serves to send this data to my email. The code I have is the following:
if (!(txtpara.Text.Trim() == ""))
{
To = txtpara.Text;
Subject = txtassunto.Text;
Body = txtmensagem.Text;
mail = new MailMessage();
mail.To.Add(new MailAddress(this.To));
mail.From = new MailAddress("[email protected]");
mail.Subject = Subject;
mail.Body = Body;
mail.IsBodyHtml = false;
SmtpClient client = new SmtpClient("smtp.gmail.com", 465);
using (client)
{
client.Credentials = new System.Net.NetworkCredential("[email protected]", "aminhapassword");
client.EnableSsl = true;
client.Send(mail);
}
MessageBox.Show("E-Mail enviado com Sucesso!", "Sucesso");
}
The error is in:
"client.Send (mail);" and says "Failed to send email" - SmtpException.