Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could use the <strong>System.Net.Mail.MailMessage</strong> class of the .NET framework.</p> <p>You can find the <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage(VS.80).aspx" rel="noreferrer">MSDN documentation here</a>.</p> <p>Here is a simple example (code snippet):</p> <pre><code>using System.Net; using System.Net.Mail; using System.Net.Mime; ... try { SmtpClient mySmtpClient = new SmtpClient("my.smtp.exampleserver.net"); // set smtp-client with basicAuthentication mySmtpClient.UseDefaultCredentials = false; System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("username", "password"); mySmtpClient.Credentials = basicAuthenticationInfo; // add from,to mailaddresses MailAddress from = new MailAddress("test@example.com", "TestFromName"); MailAddress to = new MailAddress("test2@example.com", "TestToName"); MailMessage myMail = new System.Net.Mail.MailMessage(from, to); // add ReplyTo MailAddress replyto = new MailAddress("reply@example.com"); 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 = "&lt;b&gt;Test Mail&lt;/b&gt;&lt;br&gt;using &lt;b&gt;HTML&lt;/b&gt;."; myMail.BodyEncoding = System.Text.Encoding.UTF8; // text or html myMail.IsBodyHtml = true; mySmtpClient.Send(myMail); } catch (SmtpException ex) { throw new ApplicationException ("SmtpException has occured: " + ex.Message); } catch (Exception ex) { throw ex; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload