E Business Services - Market Leading E Business Solutions

 
 

MailForm CDONTS / JMail

 
   

These examples demonstrate how to send mail from a response form on your website using either Microsoft's CDONTS or Dimac's JMail components.

 
 


Notes:

MailForm: Provides an elemental Form page that collects a small number of form variables from the website visitor.

SendCDOMail: Demonstrates the mail sender using Microsoft's CDONTS component.

SendJMail: Demonstrates the mail sender using Dimac's JMail component.

 

You should change the highlighted text to your own Domain Name

 

Mail Form

 

<form method="POST" action="sendmail.asp">
<p>Please enter your name and email address below and press send.</p>
<table border="0">
<tr>
<td width="40">Name:</td>
<td width="150"><input type="text" name="Name" size="20"></td>
</tr>
<tr>
<td width="40">Email:</td>
<td width="150"><input type="text" name="Email" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Send" name="Send"></p>
</form>

This Looks Like

Please enter your name and email address below and press send.

Name:
Email:

 

Send CDONTS Mail

 

<%

'Collect the data from the form
msgName  = Request("Name")
msgEmail = Request("Email")

'Setup some variables for the email
msgTo = "admin@YourDomain.dom"
msgFrom = msgName & "<" & msgEmail & ">"
msgSubject = "This is a form mail test"
msgBody = "The quick brown fox jumped over the lazy dog!"

'Create the CDONTS Object
Dim objMail
set objMail = Server.CreateObject("CDONTS.NewMail")

'Set up the mail parameters
objMail.To = msgTo
objMail.From = "webform@YourDomain.dom"
objMail.Value("Reply-To") = msgFrom
objMail.Subject = msgSubject
objMail.Body = msgBody

'Send the message and release the Object
objMail.Send
set objMail = nothing

'Back to normal HTML 
%>

<p><b>Sendmail Confirmation Page</b></p>
<p>Thank you <%=msgName%>. Your message has been sent.</p>

 

Send JMail

 

<%

'Collect the data from the form
msgName = Request("Name")
msgEmail = Request("Email")

'Setup some variables for the email
msgTo = "admin@YourDomain.dom"
msgFrom = msgName & "<" & msgEmail & ">"
msgSubject = "This is a form mail test"
msgBody = "The quick brown fox jumped over the lazy dog!"

'Create the Jmail Object
Dim objMail
set objMail = Server.CreateObject("JMail.SMTPMail") 

objMail.ServerAddress = "mail.YourDomain.dom:25"

'Set up the mail parameters
objMail.AddRecipient msgTo '(note the lack of a equal sign).
objMail.Sender = "webform@YourDomain.dom"
objMail.ReplyTo = msgFrom
objMail.Subject = msgSubject
objMail.Body = msgBody

'Send the message and release the Object
objMail.Execute
set objMail=nothing

'Back to normal HTML 
%>

<p><b>Sendmail Confirmation Page</b></p>
<p>Thank you <%=msgName%>. Your message has been sent.</p>

 

 

Downloads:

mailform.txt The Mail Form example in a text file

sendjmail.txt The JMail Sendmail example in a text file

sendcdomail.txt The CDO Sendmail example in a text file

References:

Microsoft www.microsoft.com - Supplier Website
Dimac tech.dimac.net - Supplier Website

 



Web Hosting | Domains | E-Mail | WebMail
Home | About | Help | StatusControl Panel | TermsContact

 

 

E Business Services

Copyright © 1998-2017 E Business Services Limited



Call - SALES - 0800 1695867
Powered By: E Business Services - DataPumps