to use the mailmessage to send emails, 1 we need to add:
using System.Net.Mail;
using System.Net;
and then instantiate a new mailmessage class, and then use the following to send a simple mail
MailMessage mail = new MailMessage();
mail.From = new MailAddress("__from_email__");
mail.To.Add("__to_email__");
mail.Subject = "Subject here";
mail.Body = "Message here";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("__smtp__");
smtp.Send(mail);
some email providers doesn´t accept an email if it doesn´t have credentials, so we must specify it, it accepts any valid email (and password) that you have, so we need the following:
smtp.Credentials = new NetworkCredential("__email__", "__password__");
and then the complete code is:
MailMessage mail = new MailMessage();
mail.From = new MailAddress("__from_email__");
mail.To.Add("__to_email__");
mail.Subject = "Erro --> Geco";
mail.Body = "Utilizador: ";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("__smtp__");
smtp.Credentials = new NetworkCredential("__email__", "__password__");
smtp.Send(mail);
hope it helps