?
Solved

ASP Script generates duplicate emails on Submit

Posted on 2007-10-03
9
Medium Priority
?
539 Views
Last Modified: 2011-09-20
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?
0
Comment
Question by:dsr79
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 20008994
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
 
LVL 20

Expert Comment

by:jitganguly
ID: 20009370
action="http://www.xxx.com/xxxx/xxxx.asp"

Can you out the actual page name e.g.
action="xxxx.asp"
0
 
LVL 16

Expert Comment

by:golfDoctor
ID: 20009595
There is nothing in that code that shows problem of looping or redirects that may cause duplicate emails.  post all the code.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 16

Expert Comment

by:golfDoctor
ID: 20009637
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
 
LVL 25

Expert Comment

by:kevp75
ID: 20009822
;).....we may be suprised
0
 
LVL 16

Expert Comment

by:golfDoctor
ID: 20009839
as always
0
 

Accepted Solution

by:
dsr79 earned 0 total points
ID: 20010112
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
 
LVL 16

Expert Comment

by:golfDoctor
ID: 20207034
still need help? if not, please close this question.
0
 

Author Comment

by:dsr79
ID: 20208742
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

840 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