Sending mail with aspSmartMail object

You may refer the sample code as below.

<%

On error resume next

Dim mySmartMail
Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail")

' Mail Server
' ***********
mySmartMail.Server = "localhost"

' From
' ****
mySmartMail.SenderName = "Your Name"
mySmartMail.SenderAddress = "youremail@yourdomain.com"

' To
' **
mySmartMail.Recipients.Add "yourfriend@anydomain.com", "Friend's name"

' Message
' *******
mySmartMail.Subject = "aspSmartMail Sample 1"
mySmartMail.Body = "This mail has been sent with aspSmartMail."

' Send the message
' ****************
mySmartMail.SendMail

if Err.Number<>0 then

Response.write "Error: " & Err.description

else

Response.write "An e-mail has just been sent to " &
mySmartMail.Recipients.Item(1).Name & "."

end if

%>

Add Feedback