ASP Script generates duplicate emails on Submit

Hi all,

I have a basic HTML page that submits three values using the GET method to an ASP script.  This ASP script generates a HTML email that is sent.

Everything works great except for the fact that two duplicate emails are being generated instead of just one email.  I am not sure what the issue is.  Here is the code on the ASP page.

<%
Dim strTo, strSubject, strBody
Dim objCDOMail
strTo = Request.QueryString("txtEmail")
strSubject = "Information Requested"
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "Dear " & Request.QueryString("txtFName")&","
strBody = strBody & vbCrLf
strBody = strBody & vbCrLf
strBody=strBody & "Thank you for requesting this information."
strBody = strBody & vbCrLf
strBody=strBody & "If You have any questions about the program or want"
strBody = strBody & vbCrLf
strBody=strBody & "to discuss your marketing, please call xxx-xxx-xxxx"
strBody = strBody & vbCrLf
strBody = strBody & "and ask to speak with a Customer Service Representative."
strBody = strBody & vbCrLf
strBody = strBody & vbCrLf
strBody=strBody & "Best Regards,"
strBody = strBody & vbCrLf
strBody=strBody & "XXXXXXX"
strBody = strBody & vbCrLf
strBody = strBody & vbCrLf
strBody = strBody & "Subscription Details"
strBody = strBody & vbCrLf
strBody = strBody & "Join Date: "
strBody = strBody & Date
strBody = strBody & " "
strBody = strBody & Time
strBody = strBody & vbCrLf
strBody = strBody & "First Name: "
strBody = strBody & Request.QueryString("txtFName")
strBody = strBody & vbCrLf
strBody = strBody & "Last Name: "
strBody = strBody & Request.QueryString("txtLName")
strBody = strBody & vbCrLf
strBody = strBody & "Email: "
strBody = strBody & Request.QueryString("txtEmail")
strBody = strBody & vbCrLf

      Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
      objCDOMail.From    = "xx@xxxx.com"
      objCDOMail.To      = strTo
      objCDOMail.Subject = strSubject
      objCDOMail.Body    = strBody
      objCDOMail.Cc         = "xx@xxxx.com"
      objCDOMail.Send
      Set objCDOMail = Nothing


%>


and here is the form on the HTML page that submits it


<form method="get" action="http://www.xxx.com/xxxx/xxxx.asp">
        <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="108"><strong><font size="2" face="Arial, Helvetica, sans-serif">First
            Name:</font></strong></td>
          <td width="192"><input type="text" name="txtFName"></td>
        </tr>
        <tr>
          <td><strong><font size="2" face="Arial, Helvetica, sans-serif">Last
            Name:</font></strong></td>
          <td><input type="text" name="txtLName"></td>
        </tr>
        <tr>
          <td><strong><font size="2" face="Arial, Helvetica, sans-serif">E-mail
            Address:</font></strong></td>
          <td><input type="text" name="txtEmail"></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="Request Info"></td>
        </tr>
      </table>
        </form>

Why are two identical emails being generated?
dsr79Asked:
Who is Participating?
 
dsr79Author Commented:
No, that was not the problem.  However, I found a solution.  Let me try to explain it and hopefully it makes sense.  In the ASP page that generated the email, I had a bunch on HTML that displayed a Thank You Message.  The HTML can be broken into three components....the header (with the menus), the body (with the thank you message) and the footer.  After reading kevp75's message, I tried removing the HTML altogether and to my surprise, it generated only one message and not two.  Now, I am not sure why the HTML was forcing the script to trigger twice.  It was basic HTML....no form tags nothing....just a static page to display the "Thank You" message.  However, that seems to be the issue.   I changed the Thank You page to one of my other pages (with some basic HTML) and that works fine.  It is the original HTML that caused the issue....it is weird.
0
 
kevp75Commented:
if objCDOMail.Cc and objCDOMail.To are the same email you'll get 2.....otherwise, I don't see any kind of looping that would cause this....

is this the whole code?
0
 
jitgangulyCommented:
action="http://www.xxx.com/xxxx/xxxx.asp"

Can you out the actual page name e.g.
action="xxxx.asp"
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
golfDoctorCommented:
There is nothing in that code that shows problem of looping or redirects that may cause duplicate emails.  post all the code.
0
 
golfDoctorCommented:
Unless of course you are testing this with the same email To email as the CC email, as kevp75 said.  But, we'd hope you are brighter than that ;)
0
 
kevp75Commented:
;).....we may be suprised
0
 
golfDoctorCommented:
as always
0
 
golfDoctorCommented:
still need help? if not, please close this question.
0
 
dsr79Author Commented:
I would like to close it.  However, I do not see an option to close it.  How do I do that?  The FAQ say there should be a "Delete Question" option at the bottom of the page.  I don't see it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.