Basic examples of sending mail using System.Net.Mail in VB.NET and C#.  Settings that require updating highlighted in red.

VB.NET Code Sample

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net.Mail" %>
<script runat="server">
  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Dim strFrom = "[email protected]"
    Dim strTo = "[email protected]"
    Dim Mail As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
    Mail.BodyEncoding = Encoding.Default
    Mail.Subject = "Test email sent from System.Net.Mail"
    Mail.Body = "Mail test"
    Mail.Headers.Add("Message-Id",
                      String.Format("<{0}@{1}>",
                      Guid.NewGuid().ToString(),
                      "domain.com"))
    Mail.Priority = MailPriority.High
    Mail.IsBodyHtml = True
    'Smtpclient to send the mail message

    Dim SmtpMail As New SmtpClient
    Dim basicAuthenticationInfo As New System.Net.NetworkCredential("[email protected]", "password")

    SmtpMail.Host = "m0#.internetmailserver.net"
    SmtpMail.UseDefaultCredentials = False
    SmtpMail.Credentials = basicAuthenticationInfo
    SmtpMail.EnableSsl = true
    SmtpMail.Port = 587

    SmtpMail.Send(Mail)
    lblMessage.Text = "Mail Sent"
  End Sub
</script>
<html>
<body>
  <form runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
  </form>
</body>
</html>

C# Code Sample

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.Mail" %>

<script language="C#" runat="server">
  protected void Page_Load(object sender, EventArgs e)
  {
    MailMessage mail = new MailMessage();

    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]");

    mail.Subject = "Test email sent from System.Net.Mail";
    mail.Body = "Mail test";
    mail.Headers.Add("Message-Id",
                      String.Format("<{0}@{1}>",
                      Guid.NewGuid().ToString(),
                      "domain.com"));

    SmtpClient smtp = new SmtpClient("m0#.internetmailserver.net");

    NetworkCredential Credentials = new NetworkCredential("[email protected]", "password");
    smtp.Credentials = Credentials;
    smtp.EnableSsl = true;
    smtp.Port = 587;
    smtp.Send(mail);
    lblMessage.Text = "Mail Sent";
  }
</script>
<html>
<body>
  <form runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
  </form>
</body>
</html>