Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

convert my CDONTS to CDOSYS contact form...

Posted on 2010-11-09
5
605 Views
Last Modified: 2012-05-10
Hello Experts,

I have an online form 'contact us' it was working previously but on Windows 2008 Server is not working.

http://www.caf-fca.org/en/contact/  So in order to work you will have to convert the CDONTS code to CDOSYS contact form, i've attached my backend code.

Set objMail = Server.CreateObject("CDONTS.NewMail")

Research revealed that CDONTS is a 32-bit module but the Windows 2008 OS the server is running on is 64-bit.

How can you fix my simple code.  I have a simple contact form:

Mr. ________
Email: _______

 
I want to fix my back end code i don't know how... please advice i'm not familiari with this please edit the thankyou.asp code for me to test it.

 



-------------------------------
Backend CODE - Thankyou.asp
--------------------------------
 <%@LANGUAGE="VBSCRIPT"%> 

  <%
Dim from, sendto, subject, attn, body, name, phone, method
Dim strSQL

Set from = Request.Form("from")
Set subject = Request.Form("subject")
Set sendto = Request.Form("to")
Set attn = Request.Form("attn")
Set body = Request.Form("message")
Set salutation = Request.Form("salutation")
Set name = Request.Form("name")
Set phone1 = Request.Form("phone1")
Set phone2 = Request.Form("phone2")
Set phone3 = Request.Form("phone3")
Set phone4 = Request.Form("phone4")
Set method = Request.Form("method")

body =	"From: " & salutation & " " & name & chr(10) & chr(13) & _
		"Preferred contact method: " & method & chr(10) & chr(13) & _
		"E-mail: " & From & chr(13) & _
		"Phone: " & "(" & phone1 & ")" & " " & phone2 & "-" & phone3 &  " Ext. " & phone4 & chr(10) & chr(13) & _ 
		"Message:" & chr(13) & body & chr(10) & chr(13) & _
		"--------------------------------------------------------------" & chr(13) & _
		"E-mail sent via CAF-FCA web forms.  Email has been sent to : " & sendto & " - " &  now() & chr(10) & chr(13) 


'--------------July 28 2004 Sending email using CDONT --------------------
	set Mail = Server.CreateObject("CDONTS.newMail")
			
		Mail.To = sendTo 
		Mail.From = name & " (" & From & ")"
		Mail.Body = body
		'Mail.Value("Reply-To") = from
		'Mail.BodyFormat = 0
		Mail.Subject = attn			
	On Error Resume Next	
		Mail.Send 
	set Mail = Nothing
'--------------------------------------------------------------------------

'On Error Resume Next
'Mail.Send
If Err <> 0 Then
   Response.Write "Error encountered: " & Err.Description
else
	Response.Write "Thank you.<br><br>Your email has been sent. Please allow at least 24 hours for a response if you requested one."
End If
%>


==================================================
This is my default.asp CONTACT form very simple
==================================================

<form method="post" action="../who_we_are/thankyou.asp" onSubmit="return checkForm(this);">
<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
 <tr bgcolor="#4775a3">
   <td colspan="2"><div align="left"><strong><font color="#FFFFFF" size="+1">*</font> <font color="#FFFFFF"> = Required field</font></strong></div></td>
 </tr>
 <tr bgcolor="#ccd9e5">
   <td width="36%" class="byline"><div align="right"> Send this e-mail to:</div></td>
   <td width="64%" class="byline"><select size="1" name="to" class="formfield">
                <option selected value="elie_azzi@caf-fca.org">General Enquiries</option>
                <option value="elie_azzi@caf-fca.org">Marketing, Communications & Media Enquiries</option>
 			    <option value="elie_azzi@caf-fca.org">CAF-FCA Conference</option>
                <option value="elie_azzi@caf-fca.org">Information Technology</option>
                <option value="elie_azzi@caf-fca.org">Programs & Corporate Development</option>						
              </select></td>
 </tr>
 
 <tr bgcolor="#DDDDDD">
   <td class="byline"><div align="right"> Attention: </div></td>
   <td><input type="text" name="attn" size="51">
   <INPUT TYPE="HIDDEN" name="note" value="Email sent from CAF-FCA Web site - http://www.caf-fca.org/english/contact.asp"></td>
 </tr>
 
 <tr bgcolor="#ccd9e5">
   <td class="byline"><div align="right"> Preferred contact method:</div></td>
   <td><select size="1" name="method" class="formfield">
                <option selected value="email">by e-mail</option>
                <option value="phone">by telephone</option>
                <option value="do not contact me">do not contact me</option>
              </select></td>
 </tr>
 
 <tr bgcolor="#DDDDDD">
   <td class="byline"><div align="right">Your name: </div></td>
   <td><select name="salutation" size="1" id="MyContactInfo_PrefixList" size="15">
     <option selected>Select One</option>
     <option value="Mr.">Mr.</option>
     <option value="Mrs.">Mrs.</option>
     <option value="Ms.">Ms.</option>
     <option value="Dr.">Dr.</option>
    </select><input type="text" name="name" size="35"></td>
 </tr>
 
<tr bgcolor="#ccd9e5">
   <td width="36%" class="byline"><div align="right"><font size="+1" color="#FF0000"><strong>*</strong></font> Your Email:</div></td>
   <td width="64%"><input type="text" name="From" size="51"></td>
 </tr> 

<tr bgcolor="#DDDDDD">
   <td class="byline"><div align="right">Your telephone: </div></td>
   <td>( <input name="phone1" id="phone1" value="" size="3" maxlength="3"> 
        )  
        <input name="phone2" id="phone2" value="" size="3" maxlength="3"> 
        -  
        <input name="phone3" id="phone3" value="" size="4" maxlength="4"> 
        Ext.:
          [ <input name="phone4" id="phone4" value="" size="6" maxlength="6"> 
          ]  </td>
 </tr>


<tr bgcolor="#ccd9e5">
   <td class="byline" valign="top"><div align="right"> What can we do for you?</div></td>
   <td><textarea cols="40" rows="5" name="message"></textarea></td>
 </tr>
  <tr bgcolor="#DDDDDD">
   <td colspan="2" class="byline" align="center">
 <input type="submit" value="Submit" name="SUBMIT">
 <input type="reset" value="Clear" name="RESET">
 </td></tr>
</table>
</form>

Open in new window

0
Comment
Question by:elieazzi
  • 3
  • 2
5 Comments
 

Author Comment

by:elieazzi
ID: 34099198
I was looking online and here what i found but i've tried many times to adjust my code i don't know how.. .please take a look.

http://www.w3schools.com/asp/asp_send_email.asp 
0
 
LVL 33

Accepted Solution

by:
hongjun earned 500 total points
ID: 34099366
Change everything within your '--------------July 28 2004 Sending email using CDONT -------------------- to following
Set Mail=CreateObject("CDO.Message")
Mail.Subject=attn
Mail.From = name & " (" & From & ")"
Mail.To=sendTo
Mail.TextBody=body			

On Error Resume Next	
	Mail.Send 	
	set Mail = Nothing

Open in new window

0
 

Author Comment

by:elieazzi
ID: 34106158
This implemeantion should be on the thankyou.asp or default.asp page. please specify...

Please advice where I should implemented in the code so I should replace this

'--------------July 28 2004 Sending email using CDONT --------------------
      set Mail = Server.CreateObject("CDONTS.newMail")
                  
            Mail.To = sendTo
            Mail.From = name & " (" & From & ")"
            Mail.Body = body
            'Mail.Value("Reply-To") = from
            'Mail.BodyFormat = 0
            Mail.Subject = attn                  
      On Error Resume Next      
            Mail.Send
      set Mail = Nothing
'--------------------------------------------------------------------------


With the following code?

Set Mail=CreateObject("CDO.Message")
Mail.Subject=attn
Mail.From = name & " (" & From & ")"
Mail.To=sendTo
Mail.TextBody=body			

On Error Resume Next	
	Mail.Send 	
	set Mail = Nothing
 

Open in new window

0
 
LVL 33

Expert Comment

by:hongjun
ID: 34108643
yes correct
0
 

Author Comment

by:elieazzi
ID: 34119655
Thank you I'm posting another question same problem pls advice.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question