Sé libre de divulgar nuestra web y códigos con otro, danos de tu ayuda para ampliar esta comunidad.
Ejemplo: c # enviar correo electrónico
usingSystem.Net;usingSystem.Net.Mail;usingSystem.Net.Mime;...trySmtpClient mySmtpClient =newSmtpClient("my.smtp.exampleserver.net");// set smtp-client with basicAuthentication
mySmtpClient.UseDefaultCredentials =false;System.Net.NetworkCredential basicAuthenticationInfo =newSystem.Net.NetworkCredential("username","password");
mySmtpClient.Credentials = basicAuthenticationInfo;// add from,to mailaddressesMailAddressfrom=newMailAddress("[email protected]","TestFromName");MailAddress to =newMailAddress("[email protected]","TestToName");MailMessage myMail =newSystem.Net.Mail.MailMessage(from, to);// add ReplyToMailAddress replyTo =newMailAddress("[email protected]");
myMail.ReplyToList.Add(replyTo);// set subject and encoding
myMail.Subject ="Test message";
myMail.SubjectEncoding = System.Text.Encoding.UTF8;// set body-message and encoding
myMail.Body ="Test Mail
using HTML.";
myMail.BodyEncoding = System.Text.Encoding.UTF8;// text or html
myMail.IsBodyHtml =true;
mySmtpClient.Send(myMail);catch(SmtpException ex)thrownewApplicationException("SmtpException has occured: "+ ex.Message);catch(Exception ex)throw ex;
Agradecemos que quieras confirmar nuestra ocupación exponiendo un comentario o valorándolo te lo agradecemos.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)