Newrain Home
 | Home | Contact | Link To Us | Web Design |

 Newrain.com, where website design and customer service go hand in hand!
Check out our programming tips for Active Server Pages!

Go to Web Design Page


Sending Mail Using CDONTS.Newmail

Need to be able to generate an order confirmation email from your site?  Or are you just looking for an easy way to send contact form information via email?  Then CDONTS is a perfect solution for you.

What is CDONTS?

CDONTS is a NewMail object that gives you the ability to send a message within an ASP page with only few lines of code. The syntax for sending mail with the NewMail object of CDONTS is as follows:

oMail.Send [From], [To], [Subject], [Body]

To send mail with the CDONTS.Newmail object use the following code:

<%
Dim oMail, strFrom, strTo, strSubject, strBody

'Load your From, To, Subject and Body variables with the appropriate strings

strFrom = youremail@yourdomain.com
strTo = recipient@theirdomain.com
strSubject = "Email from my site"
strBody = "This will contain whatever I want my email to contain." & vbCrlf & _
"This is the second line of my body text." & vbCrlf & vbCrlf & _
"I used two line breaks to add a blank line between this line and the prior."

'Note: use vbCrlf for line breaks in your body text

'Create your CDONTS.Newmail object

Set oMail = CreateObject("CDONTS.Newmail")

'Load the CDONTS.Newmail object with your variables, and execute it using
'the Send method

oMail.Send [From], [To], [Subject], [Body]

'Close out the CDONTS.Newmail object

Set oMail = Nothing

Properties of NewMail Object.
From A string value containing the email address of the sender (for example youremail@yourdomain.com)
To A string value containing the email address of the recipient.  (for example, recipient@theirdomain.com).  Multiple addresses can be added by separating with ";"
Subject The subject line for the message.
Body A string value containing the body text of message.
Cc A string containing the email addresses of recipients who will receive a copy of current message.
Bcc A string containing the email addresses of recipients who will receive a blind copy of current message.
Importance This is an Integer value that represents the priority of message.  (for example High, Normal or Low)
BodyFormat An integer value which sets the text format of NewMail Object.

ObjMail.BodyFormat = 0 (HTML format)
ObjMail.BodyFormat = 1 (default Plain Text format)
MailFormat An integer value which sets the encoding of NewMail Object.

ObjMail.MailFormat = 0 (Mime format)
ObjMail.MailFormat = 1 (default Plain Text format)


Methods of NewMail Object.
AttachFile This method attaches a file to the current mesage.
AttachURL This method attach a file to current message and associate a URL with that attachment.
Send This method sends the message.


Ranking:

What do you think?

 


Home |  Contact |  Link to Us |  Login |  Website Design |  Web Hosting |
Domain Registration |  Consulting |  Database Design |  Customer Feedback |  Awards |
© Newrain Designs