Imports System.Web.Mail
Module Module1
Sub Main()
Dim oMsg As MailMessage = New MailMessage()
' TODO: Replace with sender e-mail address.
oMsg.From = "sender@somewhere.com"
' TODO: Replace with recipient e-mail address.
oMsg.To = "recipient@somewhere.com"
oMsg.Subject = "Send using Web Mail"
' SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html
'HTML Body (remove HTML tags for plain text).
oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>"
' ADD AN ATTACHMENT.
' TODO: Replace with path to attachment.
Dim sFile As String = "C:\temp\Hello.txt"
Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64)
oMsg.Attachments.Add(oAttch)
' TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "MySMTPServer"
SmtpMail.Send(oMsg)
oMsg = Nothing
oAttch = Nothing
End Sub
End Module