Search HouseOfScripts.com

 

All Scripts        JavaScripts        ASP Scripts        Other Scripts

 

  Tips and tricks to customize CDONTS email asp, send, email, cdonts, link, recordset, hyper, hyperlink, create, list, box, dependant, dynamic

I spent long time searching on the Internet trying to figure out how to send email using CDONTS. I was able to find different peaces of information on different Web Sites. I want to summarize everything that I found.

This page shows a few tips and tricks how to customize email. If you want to see how to customize and send dynamic email click here. If you want to see how to send simple mail as soon as page loads click here. To see how to send email to multiple users that have to be picked up from the RecordSet click here.

Note that if you need to send email and body should contain long text with fields from RecordSets and from textfields you have to know a few rules:

Rule:
Example:
1.
Text should be inside quotations.
"Text is here"
2.
RecordSet and Form fields should be outside of quotations.
RecordSet1("email") or Request.Form("name")
3.
Combine text, RecordSet and Form fields using & symbol.
"Your email is " & RecordSet1("email") & " and you name is: " & Request.Form("name")
4.
If you want to break line in the message and continue on the next line (like pressing Enter when you type text) use & vbcrlf&_
"I" & vbcrlf&_
"break" & vbcrlf&_
"every" & vbcrlf&_
"line." & vbcrlf&_
"Done"
5.
If you want to break 2 or more lines in the message and continue after that use & vbcrlf as many times as you need and then & vbcrlf&_

"I" & vbcrlf & vbcrlf&_
"break" & vbcrlf & vbcrlf&_
"every" & vbcrlf & vbcrlf & vbcrlf&_
"line." & vbcrlf & vbcrlf&_
"Done"


Here is an example of the simple send mail page:

<%
if (cStr(Request("Submit")) <> "") Then
dim MailObj
set MailObj = Server.CreateObject("CDONTS.NewMail")
MailObj.From = Request.Form("name")
MailObj.To = "you@yoursite.com"
MailObj.Subject = "Important Information"
MailObj.Body = "Email was sent by: " & Request.Form("name") & vbcrlf & vbcrlf&_
"his/her email address is:" & vbcrlf&_
Request.Form("email")
MailObj.Send()
set MailObj = nothing
End If
%>
<html>
<body>
<form name="form1" method="post" action="">
<input type="text" name="name">
<input type="text" name="email">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

 

 


Home       Scripts       Active WebTools       Web Templates       Forum       Tools        Hosting       Questions/Comments       Add/Request