VB.Net Class
CMailMessage.vb
Send Email from your ASP.Net web pages
Copy and paste the code below into a VB.Net Class Module
'STARTCODE
Imports System.Web.Mail
Public Class
CMailMessage
'SMTP Mail Class
'Widget# CS0051 CodeWidgets.com
'SYNTAX to use the Class
'/////////////////
'Dim MailMessage As New CMailMessage()
'MailMessage.Send("RecipientEmail",
"SendersEmail", "The Subject", "This is the Message
Body", Mail.MailFormat.Html)
' MailMessage = Nothing
'/////////////////
Public Sub
Send(ByVal m_Recipient As
String, ByVal m_Sender
As String, ByVal
m_Subject As String, ByVal
m_Message As String, ByVal
m_Format As Mail.MailFormat)
Dim Msg As New
MailMessage()
With Msg
.To = m_Recipient
.From = m_Sender
.Subject = m_Subject
.BodyFormat = m_Format
.Body = m_Message
' Substitute HOST with the Local SMTP Domain name found
in the IIS Managment Console
Dim strMailHost As
String = "HOST"
SmtpMail.SmtpServer = strMailHost
SmtpMail.Send(Msg)
End With
End Sub
End Class
'ENDCODE
Last Updated: 4/27/2018