Forums
This topic is locked
FORM SUBMISSION SENDING DUPLICATE BLANK EMAILS
Posted 27 Nov 2006 15:35:30
1
has voted
27 Nov 2006 15:35:30 Steve Carvell posted:
Hi,I have a form which submits an email using CDONTS.
For some reason following a submission it also sends an additional email which is blank.
It doesnt always do this, and I can't find out why it might be happening.
Heres the send page: www.wearetickledpink.co.uk/ordersample.asp
Does anyone have any ideas ?..
I'm new to ASP..
Steve
Replies
Replied 05 Dec 2006 11:29:02
05 Dec 2006 11:29:02 Lee Diggins replied:
Hi Steve
Can you post the code you're using please?
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Can you post the code you're using please?
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 05 Dec 2006 14:27:17
05 Dec 2006 14:27:17 Steve Carvell replied:
Hi Lee,
Heres the code:
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting ----------------------------------
strMyEmailAddress = " "
'----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------
strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail
'----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------
strBCCEmailAddress = " " 'Use this string only if you want to send the blind copies of the e-mail
'-----------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email"
'Initialse strBody string with the body of the e-mail
strBody = "<h2>Please send me a sample</h2>"
strBody = strBody & "<b>Name: </b>" & Request.Form("First name" & "<br><b>Last name </b>" & Replace (Request.Form("Last Name", vbCrLf, "<br>" & "<br><b>Tel no: </b>" & Request.Form("tel" & "<br><b>Address </b>" & Request.Form("Address" & "<br><b>Town </b>" & Request.Form("Town Name" & "<br><b>Post Code </b>" & Request.Form("postcode" & "<br><b>How did you hear about us ? </b>" & Request.Form("Where did you hear from us ?"& "<br><b>Date of Wedding </b>" & Replace (Request.Form("date", vbCrLf, "<br>"
strBody = strbody & "<br><br>They would like one of the following samples ! "& Replace (Request.Form("", vbCrLf, "<br>"
strBody = strBody & "<br><b>Bridal Gown ? </b>" & Replace (Request.Form("bridal_gown", vbCrLf, "<br>"
strBody = strBody & "<br><b>Civil Partnership ? </b>" & Replace (Request.Form("Civil_partnership", vbCrLf, "<br>"
strBody = strBody & "<br><b>Entwined_Hearts ? </b>" & Replace (Request.Form("Entwined_Hearts", vbCrLf, "<br>"
strBody = strBody & "<br><b>Happy_couple ? </b>" & Request.Form("Happy_couple"
strBody = strBody & "<br><b>Two_Hearts ? </b>" & Request.Form("Two_Hearts"
strBody = strBody & "<br><b>Wedding_Cake ? </b>" & Request.Form("Wedding_Cake"
strBody = strBody & "<br><b>Anne_mae ? </b>" & Request.Form("anne_mae"
strBody = strBody & "<br><b>Flutterby_butterfly ? </b>" & Request.Form("Flutterby_butterfly"
strBody = strBody & "<br><b>Flower_Power ? </b>" & Request.Form("Flower_Power"
strBody = strBody & "<br><b>Handbag ? </b>" & Request.Form("Handbag"
strBody = strBody & "<br><b>Gerbera ? </b>" & Request.Form("Gerbera"
strBody = strBody & "<br><b>Single_Heart ? </b>" & Request.Form("Single_Heart"
strBody = strBody & "<br><b>Cake_stand ? </b>" & Request.Form("Cake_stand"
strBody = strBody & "<br><br><b>Question - </b><br>" & Replace(Request.Form("Question", vbCrLf, "<br>"
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
'If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " " = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, "." < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
'strReturnEmailAddress = strMyEmailAddress
'End If
'Send the e-mail
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail"
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = Request.Form("first" & " <" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Please send me a sample"
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
if instr(Request.ServerVariables("PATH_TRANSLATED","domains\w\wearetickledpink.co.uk" > 0 then
objCDOMail.Send
else
Response.write("send failed"
end if
'Close the server object
Set objCDOMail = Nothing
%>
Steve
Heres the code:
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting ----------------------------------
strMyEmailAddress = " "
'----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------
strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail
'----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------
strBCCEmailAddress = " " 'Use this string only if you want to send the blind copies of the e-mail
'-----------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email"
'Initialse strBody string with the body of the e-mail
strBody = "<h2>Please send me a sample</h2>"
strBody = strBody & "<b>Name: </b>" & Request.Form("First name" & "<br><b>Last name </b>" & Replace (Request.Form("Last Name", vbCrLf, "<br>" & "<br><b>Tel no: </b>" & Request.Form("tel" & "<br><b>Address </b>" & Request.Form("Address" & "<br><b>Town </b>" & Request.Form("Town Name" & "<br><b>Post Code </b>" & Request.Form("postcode" & "<br><b>How did you hear about us ? </b>" & Request.Form("Where did you hear from us ?"& "<br><b>Date of Wedding </b>" & Replace (Request.Form("date", vbCrLf, "<br>"
strBody = strbody & "<br><br>They would like one of the following samples ! "& Replace (Request.Form("", vbCrLf, "<br>"
strBody = strBody & "<br><b>Bridal Gown ? </b>" & Replace (Request.Form("bridal_gown", vbCrLf, "<br>"
strBody = strBody & "<br><b>Civil Partnership ? </b>" & Replace (Request.Form("Civil_partnership", vbCrLf, "<br>"
strBody = strBody & "<br><b>Entwined_Hearts ? </b>" & Replace (Request.Form("Entwined_Hearts", vbCrLf, "<br>"
strBody = strBody & "<br><b>Happy_couple ? </b>" & Request.Form("Happy_couple"
strBody = strBody & "<br><b>Two_Hearts ? </b>" & Request.Form("Two_Hearts"
strBody = strBody & "<br><b>Wedding_Cake ? </b>" & Request.Form("Wedding_Cake"
strBody = strBody & "<br><b>Anne_mae ? </b>" & Request.Form("anne_mae"
strBody = strBody & "<br><b>Flutterby_butterfly ? </b>" & Request.Form("Flutterby_butterfly"
strBody = strBody & "<br><b>Flower_Power ? </b>" & Request.Form("Flower_Power"
strBody = strBody & "<br><b>Handbag ? </b>" & Request.Form("Handbag"
strBody = strBody & "<br><b>Gerbera ? </b>" & Request.Form("Gerbera"
strBody = strBody & "<br><b>Single_Heart ? </b>" & Request.Form("Single_Heart"
strBody = strBody & "<br><b>Cake_stand ? </b>" & Request.Form("Cake_stand"
strBody = strBody & "<br><br><b>Question - </b><br>" & Replace(Request.Form("Question", vbCrLf, "<br>"
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
'If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " " = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, "." < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
'strReturnEmailAddress = strMyEmailAddress
'End If
'Send the e-mail
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail"
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = Request.Form("first" & " <" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Please send me a sample"
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
if instr(Request.ServerVariables("PATH_TRANSLATED","domains\w\wearetickledpink.co.uk" > 0 then
objCDOMail.Send
else
Response.write("send failed"
end if
'Close the server object
Set objCDOMail = Nothing
%>
Steve
Replied 05 Dec 2006 14:58:07
05 Dec 2006 14:58:07 Lee Diggins replied:
Hi Steve
I can't replicate this problem using your code, I only get 1 email, your code is fine.
I have heard in the past about email client bugs where they process an email as two items, think this affected Outlook or Outlook Express, can't remember which.
Can you try with a different client or add my email address to a test send -
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
I can't replicate this problem using your code, I only get 1 email, your code is fine.
I have heard in the past about email client bugs where they process an email as two items, think this affected Outlook or Outlook Express, can't remember which.
Can you try with a different client or add my email address to a test send -
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 05 Dec 2006 15:07:09
05 Dec 2006 15:07:09 Steve Carvell replied:
Hi Lee,
Thanks for your support over this....
Touch-wood I dont seem to have had any duplicates since removing this line of code:
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
'If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " " = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, "." < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
'strReturnEmailAddress = strMyEmailAddress
'End If
I have however had a few spam emails which have populated all fields with a random email addres eg
Do you think using CAPTCHA will eliminate this ?
Steve
Thanks for your support over this....
Touch-wood I dont seem to have had any duplicates since removing this line of code:
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
'If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " " = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, "." < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
'strReturnEmailAddress = strMyEmailAddress
'End If
I have however had a few spam emails which have populated all fields with a random email addres eg
Do you think using CAPTCHA will eliminate this ?
Steve
Replied 05 Dec 2006 15:24:04
05 Dec 2006 15:24:04 Lee Diggins replied:
Hi Steve
Your spam issue is probably due to having a mailto link in your footer or spammers just chancing on being delivered.
CAPTCHA helps with automated form submission attempts so if you're getting completed forms submitted then it's definately worth adding to the page to block these.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Your spam issue is probably due to having a mailto link in your footer or spammers just chancing on being delivered.
CAPTCHA helps with automated form submission attempts so if you're getting completed forms submitted then it's definately worth adding to the page to block these.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 05 Dec 2006 15:42:26
05 Dec 2006 15:42:26 Steve Carvell replied:
Hi Lee,
The mailto link is coded in hex, rather than plain text which I thought helped ?
I will add the CAPTCHA in the next couple of days...
If you have more than one form using CDONTS, when submitted I assume it will only send that particular form (not all forms on the site which use CDONTS). I just read something somewhere which said if CDONTS is used it can submit all your forms at the same time ?
Steve
The mailto link is coded in hex, rather than plain text which I thought helped ?
I will add the CAPTCHA in the next couple of days...
If you have more than one form using CDONTS, when submitted I assume it will only send that particular form (not all forms on the site which use CDONTS). I just read something somewhere which said if CDONTS is used it can submit all your forms at the same time ?
Steve
Replied 05 Dec 2006 16:10:17
05 Dec 2006 16:10:17 Lee Diggins replied:
Hi Steve
Mailto - sorry didn't notice.
CDONTS - never heard that before, depends on how you handle form submission I would've thought.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Mailto - sorry didn't notice.
CDONTS - never heard that before, depends on how you handle form submission I would've thought.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 05 Dec 2006 16:13:57
05 Dec 2006 16:13:57 Steve Carvell replied:
Hi Lee,
Thanks for all your support over this
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
kind regards
Steve
Thanks for all your support over this
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
kind regards
Steve