Re: enviar emailes con asp.net
Código:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("relay-hosting.xxxxxxxxxxx.net",25);
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("consultas@xxxxxxxx.com");
System.Net.Mail.MailAddress to = new System.Net.Mail.MailAddress("sebastian@xxxxxxxx.com");
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(from, to);
msg.Subject = "Mail desde la pagina";
msg.Body = "De:" + txtEmail.Text + ";" + System.Environment.NewLine;
msg.Body += txtMensaje.Text;
msg.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.NetworkCredential nc = new System.Net.NetworkCredential(System.Configuration.ConfigurationManager.AppSettings["mailUser"], System.Configuration.ConfigurationManager.AppSettings["mailPwd"]);
client.Credentials = nc;
client.Send(msg);
|