<%@ Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim msg as New MailMessage()
msg.To = "mailto@sender.com"
msg.From = "sender@domain.com"
msg.Subject = "test"
'msg.BodyFormat = MailFormat.Html
msg.BodyFormat = MailFormat.Text
msg.Body = "hi"
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "domain.com")
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2) '2 to send using SMTP over the network
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "email@domain.com") 'set your username here
msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456") 'set your password here
' SmtpMail.SmtpServer = "domain.com"
SmtpMail.Send(msg)
msg = Nothing
lblMsg.Text = "An Email has been Sent"
End Sub
</script>
<form runat=server>
<asp:Label id=lblMsg runat=Server /> </form>