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>
|
- How to Refresh a web page or redirect to another page
- Custom Paging in ASP Fast And Easy
- Professional Contact Form
- Creating Access Database Connection String
- Using DateDiff function in SQL Statement
- VBScript Examples DatePart Function
- Executing Transact SQL UPDATE statement using SQLCommand
- Custom Paging results in ASPNET using A Better Way
- Sending Emails in JSP
- MySQL AB Offers its Enterprise Database Subscriptions through the New Red Hat Exchange
- Display Top N records from MS Access
- How to display date time in real time
- JSP Hit Counter Free Open Code
- ASP Ikon Ad Manager UPDATED
- List of Locale ID LCID Values as Assigned by Microsoft
- 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