Form to Mail Using CDO
In this article, we will use CDO instead of CDONTS. CDO comes within windows XP and windows 2000/3 and has more control over mailing system. Following asp source contains a simple webform and client side validation that controls unvalid characters. Web form uses CDO to deliver form results to your email account.
To use the sample code all you need to change "YOUR_MAIL_SERVER" and "YOUR_EMAIL" variables in the code.
|
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <SCRIPT language=javascript> <!-- hide JavaScript code from browsers that are not JavaScript enabled function isEmpty(s) function isWhitespace (s) if (isEmpty(s)) return true; for (i = 0; i < s.length; i++) var c = s.charAt(i); if (whitespace.indexOf(c) == -1) return false; return true; function isEmail(s) { if (isWhitespace(s)) { var sLength = s.length; while ((i < sLength) && (s.charAt(i) != "@")) { if ((i < 2) || (i > (sLength - 3)) || (s.charAt(i) != "@")) { Index = i; while ((i < sLength) && (s.charAt(i) != ".")) {
if ((i < (Index + 3)) || (i >= sLength - 2) || (s.charAt(i) != ".")) { while (i < sLength) { } function checkform() { var message = ""; // create error message string variable, with nothing in it if (document.newForm.name.value.length == 0) { if (document.newForm.subject.value.length == 0) { if (document.newForm.message.value.length == 0) { if (!(isEmail(document.newForm.email.value))) { if ( message.length > 0 ) { // is there an error message? } } // end of the function checkform() //end hiding of JavaScript code --> <% msg = "Web Form " & chr(10) & chr(10) Set objMail = Server.CreateObject("CDO.Message") With objMail Set objFields = Nothing response.write "<b>Thank you very much for your post.</b>" <table border="0" width="100%" cellpadding="0" bgcolor="#FFFFFF"> </td> </center> </body>
|
- ASP Chat Box
- Working with Array Remove An Item
- ASPNET Web Counter Free Open Source Code
- Beginning-Ajax-and-ASPNET-35
- How to upload images to mySQL within PHP
- Delete Files Online in ASP
- Video Interview With Roman Strobl
- Custom Paging in ASP Fast And Easy
- How to write and use a JavaBean My frst java bean
- Displaying Records From An Excel Database
- Paging Results in PHP
- Installing Sun Java System Application Server 9.1 in Solaris Zones
- Java SE 6 Performance White Paper
- Converting sceonds to hours minutes and seconds
- Encoding URL strings
- Easy Download Manager Free Version
- ASP Chat Box
- Writing Form Data to Text Files
- Paging Records in JSP
- What is Ecommerce and the Importance of Ecommerce
- Beginning-Ajax-and-ASPNET-35
- How to upload images to mySQL within PHP
- Simple XML RSS Parser
- Counting records in PHP mySQL
- ActiveNews Manager Freeware News Exchange Software
- How to write and use a JavaBean My frst java bean
- Paging Results in PHP
- Free User Registration Form
- A-timesaver-control-GridView
- ASPNET Web Counter Free Open Source Code
- Easy Download Manager Free Version
- ASP Chat Box
- Writing Form Data to Text Files
- Paging Records in JSP
- Beginning-Ajax-and-ASPNET-35
- How to upload images to mySQL within PHP
- Simple XML RSS Parser
- ActiveNews Manager Freeware News Exchange Software
- Counting records in PHP mySQL
- How to write and use a JavaBean My frst java bean
- Paging Results in PHP
- Free User Registration Form
- A-timesaver-control-GridView
- ASPNET Web Counter Free Open Source Code
- Comparing Dates