ASP CDONTS Mail Component Tutorial
The CDONTS component is a great email component to use on your ASP pages.
Below are some sample CDONTS Mail scripts to use on your ASP pages:
To send a text-based message using CDONTS:
<%
dim mail
'Create the object
set mail = server.CreateObject("CDONTS.NewMail")
mail.From = "anyone@yourdomain.com" 'This is the address that
the email is
coming from.
mail.To = "anyone@somewhere.com" 'This is the email address
that you are
sending to.
mail.Subject = "Here is the subject" 'The subject as it will
appear in the
email.
mail.body = "The body of the email." 'Place the body here.
'If you want to place a carriage return in the body use vbCrLf.
mail.Send 'Send the message out.
set mail = nothing 'Clean up after yourself.
%>
|
To send an HTML-based email using CDONTS:
<%
'Place these before the mail.body.
mail.mailFormat = 0
mail.bodyFormat = 0
%>
|
To send an attachment using CDONTS:
<%
mail.AttachFile server.MapPath("attachedfile.asp") 'You must
use the exact server path.
%>
|
To send a carbon copy using CDONTS:
<%
mail.Cc = "someoneelse@somewhere.com"
%>
|
To display a message in the from section:
<%
mail.value("Reply-To") = "someone@somewhere.com"
mail.from = "I am sending this to you"
'Your message will now display in the from email address instead of your
email address.
'If someone replies to your email, they will still reply to someone@somewhere.com
%>
|
For More Information Click Here