close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple emails still being sent using Universal Email

Thread began 6/15/2015 9:58 am by illbe322016 | Last modified 6/16/2015 1:17 pm by Ray Borduin | 1129 views | 7 replies |

illbe322016

Multiple emails still being sent using Universal Email

My client uses Gmail as their email provider. I have a form that is filled out by a potential customer, the form is submitted to another page that 1.) Inserts the form data into a mySQL table. 2.) Runs a query based on the form info and returns pricing to the client on screen and 3.) Sends a copy of the pricing information to the customer and CC's to us.

The problem is that emails keep getting re-sent, it may be the next day, it may be two days later but emails will be resent sometimes multiple times. I believe this is an issue with the email provider as I don't think UE could resend the another email the next day. Google is the email recipient for my client and they have been little help. Can someone please take a look at my code and let me know if I have something wrong, this has been major brain damage.

Sign in to reply to this post

Ray BorduinWebAssist

Try adding a time to the email body. That will tell you if the web site is requesting the email to be sent at a later date or if it is the email server delaying the send.

If you just add:

php:
sent:<?php echo(date('m/d/Y h:i:s a')); ?>



To the email body, that will include the date that the email was sent to the SMTP server. If that date is from a day or two before, that would confirm it isn't a problem with your script and that it is indeed an issue with the email server.

Sign in to reply to this post

illbe322016

Hi Ray, I enabled logging as you suggested before and found that emails ARE being sent more than once but after a day or so, I don't understand how this can be, I figured that if the form was sent once it was not stored and able to be sent again a day later. Can you please make sure I have things set up correctly or if there is an issue with UE5?

Thanks

Tom

Sign in to reply to this post

Ray BorduinWebAssist

HTML should be stateless... so unless you do something to save the fields, they shouldn't be saved.

If you attach a copy of the page and the email body and email includes I can take a look to see, but I really can't imagine the cause. Is it possible that google bots are hitting the page and it is sending from the most recent order in the database causing it?

It must not be sending only from form posts. I'm going to have to see the page and context to debug. Are you sure there is only one page that might send emails?

Sign in to reply to this post

illbe322016

Thanks Ray, here are the pages. aircraft-engine-quote.php is the form the user fills out, pyaQuoteDataResults.php is the destination of the form data and email trigger, waue_pyaQuoteData_resultsBeta_5.php is the actual email body.

Thanks for the help, this has been major brain damage.

Tom

Sign in to reply to this post

Ray BorduinWebAssist

I see you are doing everything with URL parameters instead of form POST values... and you aren't even redirecting after sending the email.

That means that if the user closes their browser window and then opens up their browser again a few days later and it is set to re-open previous pages, it will send the email again. Also if someone refreshes the page, or goes to it in their history. They could even post it and send it to someone and it could be indexed and followed by bots and send emails.

I'd suggest maybe setting a session variable on the first page and clearing it after sending the email and adding a check to see that session variable exists before sending the email so that they would have to go back to the first page and fill it out instead of just refreshing or re-visiting the second page.

So on aircraft-engine-quote.php add this to the top of the page:

php:
<?php

if ((isset($_GET["MM_insert"])) && ($_GET["MM_insert"] == "quoteForm")) {
  @
session_start();
  
$_SESSION['sendonce'] = 1;
}
?>



Then on your pyaQuoteDataResults.php page add this to the very top:

php:
<?php

@session_start();
?>



and then update the email trigger on line 104 to:

php:
if ((!($totalRows_WADApyaQuoteData == 0)) && isset($_SESSION['sendonce']))     {



then below the email code before any html add:

php:
<?php

unset($_SESSION['sendonce']);
?>



That should ensure you only send one email per insert into the database no matter what.

( also you have script and css code above your <html> tag on the results page.... the code from lines 235-259 should be moved inside the <head> tag that begins on line 263 )

Sign in to reply to this post

illbe322016

Thank you Ray, I guess I need to bone up on my session variables.

The way this was to work was the user would fill out the form, submit it and be taken to a page that gave them the pricing their form choices queried from the database, at the same time that information was to be emailed to the user and the client when the results page loaded. Can you perhaps give me an idea of how I SHOULD have set this up, obviously I muffed a lot of things. Session variables are new to me so I need to understand them a bit better as well. Any suggestions you have will be appreciated.

Thank you for the help to the immediate problem as well, I can't begin to tell you how grateful I am. I have never regretted investing in Webassist solutions mainly thanks to the excellent support.

All the best

Tom

Sign in to reply to this post

Ray BorduinWebAssist

If you do things with form POST they won't happen again unless the form posts again. If you use $_GET then the form is all in the URL. This means that simply visiting the page again is the same as re-submitting the form. I recommend only using $_GET when you want a page to be able to be bookmarked. (like a search form that has results they may want to re-visit or share)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...