Imports Microsoft.VisualBasic
Imports System.Net.Mail
Imports System.IO
Imports System.Web.Mail
Public Class SendMailClass
Public Shared Sub SendMailMessage(ByVal body As String)
Dim smtp As New Net.Mail.SmtpClient
Dim m As New Net.Mail.MailMessage
m.Subject = "TV Conference request notification."
m.From = New Net.Mail.MailAddress("[email protected]")
m.To.Add("e-mail คนรับ")
'm.CC.Add("e-mail คนรับ") '<< กรณีมี CC
'm.IsBodyHtml = True
m.Body = body
Dim Auth As New System.Net.NetworkCredential("[email protected]", "passwordmail") '<< e-mail และ password ที่จะใช้ส่ง
smtp.UseDefaultCredentials = False
smtp.Credentials = Auth
smtp.Host = "ค่า smtp" '<< ถ้าถูกต้องก็ใช้งานได้
smtp.Send(m)
End Sub
End Class