Using the ASPMail component to send a message from a web page is as simple as:
- Creating the object
- Setting a few properties
- Calling the SendMail method
following code demonstrates how to use AspMail from VBScript on a .asp
web page. In this example, Joe from Joe’s Widgets wishes to send an
email to John Smith. Joe’s outgoing SMTP server is located at
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Joe’s Widgets Corp."
Mailer.RemoteHost = "smtp.mydomain.com"
Mailer.AddRecipient "John Smith", "email@example.com"
Mailer.Subject = "Great SMTP Product!"
Mailer.BodyText = "Dear Stephen" & VbCrLf & "Your widgets order _
has been processed!"
if Mailer.SendMail then
Response.Write "Mail sent..."
Response.Write "Mail send failure. Error was " & Mailer.Response
By testing the result of the SendMail method we can determine if the mailing process was successful or not.
Note: Change the RemoteHost parameter to use the name of your own domain.
RemoteHost = "smtp.mydomain.com"
When your website was first setup, two files were placed in your /scripts folder:
Please reference these files for a complete working example.
For full documentation and more examples of using ASPMail, please visit ServerObjects.com