Esempio C# per l'invio di mail in formato HTML

C#

//using System.Net.Mail
try 
{
  using(MailMessage mm = new MailMessage())
  {
    mm.IsBodyHtml = true;
    mm.From = new MailAddress("mittente@domnio.it");
    mm.To.Add(new MailAddress("detinatario@dominio.it"));
    mm.Subject = "Test email HTML";
    mm.Body = "<div style='color:red'>Messaggio da <a href='http://www.sgart.it>Sgart</a></div>"; 
    mm.Attachments.Add(new Attachment("nomeFile.txt"));

    SmtpClient client = new SmtpClient();
    client.Send(mm);
  }
}
catch
{
  // se l'invio va in errore...
}
Tags:
C#235 Esempi224 HTML74
Potrebbe interessarti anche: