Simple ASPMail Example

Post new topic   Reply to topic

View previous topic View next topic Go down

Simple ASPMail Example

Post by sakthi on Wed Jan 09, 2008 6:13 pm

Using the component is as simple as

1. Creating the object
2. Setting a few properties
3. Calling the SendMail method

The following code demonstrates how to use AspMail from VBScript. In this example Joe from Joe’s Widgets wishes to send an email to John Smith at Tools Corp. Joe’s mail server is located at mailhost.localisp.net.


Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Joe’s Widgets Corp."
Mailer.FromAddress= "Joe@Widgets.com"
Mailer.RemoteHost = "mailhost.localisp.net"
Mailer.AddRecipient "John Smith", "jsmith@toolscorp.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..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if

By testing the result of the SendMail method we can determine if the mailing process was successful or not.

Regards
Sakthi

sakthi
Leader

Posts: 187
Join date: 2007-12-02
Age: 25
Location: Coimbatore

View user profile

Back to top Go down

Re: Simple ASPMail Example

Post by technicalganesh on Thu Jan 17, 2008 9:54 am

Good! and crispy

technicalganesh
Leader

Posts: 33
Join date: 2007-12-11
Age: 33
Location: Coimbatore

View user profile

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You cannot reply to topics in this forum