473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

cdosys works but sends me two emails and doesn't want to redicect

Hi there, I'm trying to get my cdosys code to work for email purposes. I am a newbie to all of this so any help will be appreciated. I have two questions:
Firstly my submit form goes directly to the thank_u.htm page when someone clicks on the link to go to my submit form.
Secondly if I take the response.redirect line out of my code, I get an empty email when someone opens the page and then the second one when the person clicks on the submit button. (The second email works fine.)
I think the answer for 1 should solve 2 as well.
Here is my code.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Submit Query</title>
  4. <link rel="stylesheet" type="text/css" href="../css/submit.css">
  5. </head>
  6. <h1>QUOTE FORM</h1>
  7. <body>
  8.  
  9.     <form name="feedback" method="post" action="submit.asp">
  10.         <label for="user">Your Name:</label>
  11.         <input type="text" name="txtName" ><br>
  12.  
  13.         <label for="user">The Name of your Business:</label>    
  14.         <textarea name="txtBusiness" id="newsize" ></textarea><br>
  15.  
  16.         <label for="user">Your Email Address:</label>    
  17.         <input type="text" name="txtEmail" class="text"><br>
  18.  
  19.         <label for="user">Your Cellphone number:</label>       
  20.         <input type="text" name="txtCell" ><br>
  21.  
  22.  
  23.         <label for="user">Registered with us: [y/n]</label>
  24.         <input type="text" name="txtRegistered" ><br>
  25.  
  26.         <label for="user">Your Quote:</label>    
  27.         <textarea name="txtQuote" class="input"></textarea><br>
  28.  
  29.  
  30. <a href="#"><input type="submit" class="submit" value="Submit"></a>
  31.  
  32.     </form>
  33.  
  34. </body>
  35.  
  36.  
  37.  
  38. </html>
  39.  
  40.  
  41. <%
  42.  
  43.  
  44. Dim HTMLBody
  45.  
  46. HTMLBody = HTMLBody & Replace(Request.Form("Contact_"), vbCrLf, "<br />") & "<br>" & "<br>"
  47. HTMLBody = HTMLBody & "<strong>" & "Your Name : " & "</strong>" & Request.Form("txtName") & "<br>"
  48. HTMLBody = HTMLBody & "<strong>" & " The Name of your Business : " & "</strong>" & Request.Form("txtBusiness") & "<br>"
  49. HTMLBody = HTMLBody & "<strong>" & "Your Email address : " & "</strong>" & Request.Form("txtEmail") & "<br>"
  50. HTMLBody = HTMLBody & "<strong>" & "Your Cellphone Number : " & "</strong>" & Request.Form("txtCell") & "<br>"
  51. HTMLBody = HTMLBody & "<strong>" & "Registered with us [y/n] : " & "</strong>" & Request.Form("txtRegistered") & "<br>"
  52. HTMLBody = HTMLBody & "<strong>" & "Your Quote : " & "</strong>" & Request.Form("txtQuote") & "<br>"
  53.  
  54.  
  55.  
  56. 'Create the e-mail server object 
  57. Set objCDOSYSMail = Server.CreateObject("CDO.Message") 
  58. Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") 
  59. 'Outgoing SMTP server 
  60. objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
  61. objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
  62. objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  63. objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 
  64. objCDOSYSCon.Fields.Update 'Update the CDOSYS Configuration 
  65. Set objCDOSYSMail.Configuration = objCDOSYSCon 
  66. objCDOSYSMail.From = "**.*****.co.za    "
  67. objCDOSYSMail.To = "**@*****.co.za" 
  68. objCDOSYSMail.Subject = "Test"
  69. objCDOSYSMail.HTMLBody = htmlBody
  70. objCDOSYSMail.Send 
  71. 'Close the server mail object 
  72. Set objCDOSYSMail = Nothing 
  73. Set objCDOSYSCon = Nothing 
  74.  
  75. %>
Feb 20 '12 #1
4 2047
Does anyone have any pointers or suggestions?
Mar 1 '12 #2
jhardman
3,406 Expert 2GB
sending emails from asp code is one of the most frustrating things I have ever tried. Often your host will lock it down even though there is no issue in your code. Have you tried talking to your web host? They might have documentation available.

Jared
Mar 1 '12 #3
hi jhardman

After trying lots of different code I asked my web host and they actually gave me this one. With instructions for the settings that I needed to change. I checked to see if I missed anything but I haven't.
Mar 5 '12 #4
I thought that maybe the problem is with the html code but that doesn't really make sense to me. Thanks for your initial reply.
Mar 5 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: tshad | last post by:
This is a problem that we saw before on our asp site, but don't know how to fix it. We are seeing it on our .net site also. We have our email sending from our Windows 2003 server with exchange...
0
by: ifeoma | last post by:
I have a script which sends emails through Access. It sends these emails as if it was sent through Outlook. I had no problem with this using Office 2000 but with the newer Outlook 2002 it asks if I...
12
by: savedelhi | last post by:
Hi, I'm a relative newby and have a tricky problem in Access 2002. I have a continuous form with a check box called "Select". (I now know I shouldn't have called it that but it's way too late...
6
by: Chris Ashley | last post by:
I have been tearing my hair out (or indeed, what's left of it) all day with this one. I'm not sure if it's a .NET issue, a server issue or anything else and would appreciate any guidance. ...
4
by: Helen Trim | last post by:
I have a program that sends emails automatically. It works correctly, but each time it sends an email, a message appears warning the user and they have to wait 5 seconds for the Yes button to...
5
by: ozzii | last post by:
Hi, I have a asp email script which uses cdosys to send emails with attahcments by iterating through a record set of 500 email addresses. However the script simply times out. I know you can...
4
by: anonymoushamster | last post by:
I am using the built in membership system and its great. However I need users to be able to login via another page , and for the session to be initialised for a user ( basically so they dont have...
1
by: reemamg | last post by:
I've two frames in a page. On the left Frame i've buttons , if we click on button the particular pages will be loaded in the middle Frame. This code works perfectly in Firefox but not in IE ... ...
1
by: lisa007 | last post by:
i have a form if user forgot password it send the new password to the user email but now i'm trying to is to also send when user register but is not wrking this is the forgot password which works...
8
by: vertigo262 | last post by:
Hi, Was wondering if anyone had a sample stored procedure code that relates to what I'm trying to do. I have a SQL table called MailQueue with fields MailQueue - FromName
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.