Public Function SendMail(ByVal s_mailfrom As String, ByVal s_mailto As String, ByVal s_subject As String, ByVal s_message As String) As Integer
' --- Send email
' imports system.net.mail
' --- Construct the message
Dim mymessage As MailMessage
mymessage = New MailMessage
mymessage.To.Add(s_mailto)
mymessage.From = New MailAddress(s_mailfrom)
mymessage.Subject = s_subject
mymessage.Body = s_message
' --- do the actual sending
Dim mysmtp As New SmtpClient("your.smtp.server")
mysmtp.Send(mymessage)
End Function
To add an attachment from a file defined in the string s_filehandle, add the following to the code:
mymessage.Attachments.Add(New Attachment(s_filehandle))
To send html mail instead of plain text, add the following tag
mymessage.IsBodyHtml = True