Continually Improving.... let us know how support@devdiamond.net Sign in | Sign up
home articles news blog forum  

 
 


 
Skip Navigation LinksHome > Article > Advanced ASP :: Sending Emails using CDONTS
Advanced ASP :: Sending Emails using CDONTS
Abstract :
Sending Emails form your ASP page is easy, see a real example of a page that sends emails from you pages using CDONTS, ITS VERY EASY!

Views : 9454
Published : Thursday, February 21, 2002
By
HyperLink

Avarage Rating :
Page Page 1 of 1

The code below consist of two sections. The first is the actaul HTML for the form that you will need to place on your contact page, and the second is the ASP file that sends the form input to your email address.
Add this code to the page you wish to send email from.

<form action="cdonts.asp" method="POST">
<input type="hidden" name="recipient" size="25" value="youremail@yourserver.com">
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td>Name </td>
<td><input type="text" name="name" size="25"></td>
</tr>
<tr>
<td>Email </td>
<td><input type="text" name="email" size="25"></td>
</tr>
<tr>
<td>Message </td>
<td><textarea rows="7" name="message" cols="30"></textarea></td>
</tr>
</table>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</form>


The Script - cdonts.asp
This is the ASP page that sends the email and then redirects the person who filled your form in to thankyou.asp.

<% @language="VBSCRIPT" %>

<%
Set objMail = Server.CreateObject("CDONTS.Newmail")
objMail.To = request.form ("recipient")
objMail.Subject = request.form ("name")
objMail.From = request.form ("email")
objMail.Body = request.form ("message")
objMail.Send
Set objMail = Nothing


Response.Redirect "thankyou.asp"

%>



About Author

        Yasir Send Feedback
        Yasir is a .NET expert, with over 5 years experience in Microsoft Technologies, 8 years overall programming experience, he is the owner, founder & primary contributor of Minwar.com, and he also works as IT Director in the hospitality industry.