We help IT Professionals succeed at work.

ASP Script generates duplicate emails on Submit

dsr79
dsr79 asked
on
559 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?
Comment
Watch Question

Commented:
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?
action="http://www.xxx.com/xxxx/xxxx.asp"

Can you out the actual page name e.g.
action="xxxx.asp"
Top Expert 2007

Commented:
There is nothing in that code that shows problem of looping or redirects that may cause duplicate emails.  post all the code.
Top Expert 2007

Commented:
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 ;)

Commented:
;).....we may be suprised
Top Expert 2007

Commented:
as always
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Top Expert 2007

Commented:
still need help? if not, please close this question.

Author

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.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.