Sending
Microsoft SMTP Service Simple Mail Transport Protocol Does not support the Post Office Protocol (POP) InetPub\MailRoot\Pickup InetPub\MailRoot\Drop Send receive
Sending a Simple Message Sub Button_Click( s As Object, e As EventArgs ) SmtpMail.Send( _ mailfrom.Text, _ mailto.Text, _ mailsubject.Text, _ mailbody.Text ) End Sub
Sending a Simple Message SendMail.aspx Send Mail: From: <asp:TextBox ID="mailfrom" Columns="50" Runat="Server" /> To: <asp:TextBox ID="mailto" Columns="50" Runat="Server" /> Subject: <asp:TextBox ID="mailsubject" Columns="50" Runat="Server" /> Body: <asp:TextBox ID="mailbody" TextMode="Multiline" Columns="50" Rows="10" Runat="Server" /> <asp:Button Text="Send!" OnClick="Button_Click" Runat="Server" />
Adding Attachments <% Dim objMailMessage As MailMessage Dim objMailAttachment As MailAttachment ' Create the Mail Attachment objMailAttachment = New MailAttachment( "c:\BizPlan.doc" ) ' Create the Mail Message objMailMessage = New MailMessage objMailMessage.From = objMailMessage.To = objMailMessage.Subject = "Secret Business Plan" objMailMessage.Body = "Here's the plan (don't show it to anyone!)" objMailMessage.Attachments.Add( objMailAttachment ) ' Send the Mail Message SmtpMail.Send( objMailMessage ) %> BizPlan Sent!
Sending HTML <% Dim objMailMessage As MailMessage Dim strHTMLBody As String ' Create the HTML Message Body strHTMLBody = " " & _ " Thank You! " & _ " " & _ "Thank you for registering!" & _ " " ' Create the Mail Message objMailMessage = New MailMessage objMailMessage.From = objMailMessage.To = objMailMessage.Subject = "Thanks for Registering!" objMailMessage.Body = strHTMLBody objMailMessage.BodyFormat = MailFormat.HTML ' Send the Mail Message SmtpMail.Send( objMailMessage ) %> HTML Sent!