Send Mail Function for VB.NET (ASP.NET)
Posted on June 13th, 2008 by .: Adam
For some reason, I wasn’t able to figure this simple little process out on my own with the help of Google. Everything I found was way over complicated. This is short, sweet, and works =)
Public Shared Sub SendMail(ByVal fromaddress As String, ByVal toaddress As String, ByVal body As String, ByVal subject As String)
Dim mailServer As String = "smtp.mailserver.com"
Dim message As MailMessage = New MailMessage(fromaddress, toaddress, subject, body)
Dim mailClient As SmtpClient = New SmtpClient
message.IsBodyHtml = True
mailClient.Host = mailServer
mailClient.Send(message)
message.Dispose()
End Sub
BAM! Thanks Joe!
.: Adam
Discussion Area - Leave a Comment