Script to send mail using
All outgoing mail sent from DotNetted customer sites
must be routed through our mailserver using authentication
to provide additional security and guard against abuse
- for this reason the SMTP service is not installed
on our web servers so CDONTS and CDOSYS are not available
to your .asp scripts for sending mail.
Instead we provide the very popular and
reliable AspEmail component from Persits
to enable you to send mail from your ASP
scripts. AspEmail is totally reliable, offers
many additional features over CDO and typically
uses a lot less code to do the same job.
Full information on AspEmail as well as
many sample scripts and the full object
reference can be found on the authors web
site : www.htmlEmail.com
Simple ASP Script to send
mail using AspEmail
The following is a very basic script to
send a mail from an .asp page (we will build
on this mail in the next
scripting example to retrieve and e-mail
information from a form). Note that lines
starting ' are explanatory only - these
lines are not parsed by the server.
' First Step is
to create the AspEmail message object
Set Mail = Server.CreateObject("Persits.MailSender")
' Set the from address
value within the quotes with your own
Mail.From = "email@example.com"
' Add the e-mail
recipient address - again replace value
within the quotes with your own
' Set the subject
for the e-mail
Mail.Subject = "Test mail via AspEmail"
' Create the body
text for the e-mail
Mail.Body = "This mail was sent via
' The mail server
requires that we authenticate so supply
username and password
Mail.Username = "firstname.lastname@example.org"
Mail.Password = "password"
' The e-mail is
now ready to go, we just need to specify
the server and send
Mail.Host = "smtp.dotnetted.co.uk"
' Mail is sent -
tidy up and delete the AspEmail message
Set Mail = Nothing
That's it - you just need to substitute
your own values where required and you should
be able to copy this script to your account
and send your first e-mail.
Note that as we use authentication the
'Mail.From' e-mail address must be a live
user on our mailserver and should match
the address used for the 'Mail.Username'.
This is a very basic script, for more information and
the additional options available within AspEmail please
visit the authors web site : www.htmlemail.com