Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Mail Form Recipients Receiving Multiple Copies
    primarykey
    data
    text
    <p>I have a PHP mail form that I've set up which utilizes AJAX &amp; jQuery to validate and submit the form. Everything seems to work fine, but for whatever reason my client (the website owner) receives multiple copies of each mail send. The number of copies varies from 1 to 10 copies of each message, with no specific pattern.</p> <p>In all the tests I've done I personally only receive 1 copy of the message at my business email address, and at another gmail account as well. Yet the client, whose domain registrar hosts their email accounts, receives anywhere up to 10 copies at once.</p> <p>We are hosting the website, and therefor our server is processing the form each time a message is sent. I've checked our server mail logs and can confirm that it's only being sent out once. </p> <p>This is driving me nuts. We're not spending hours trying to figure this out and losing money with every minute wasted on this issue.</p> <p>I'll provide you with my code and the live website. Hopefully someone can help me out!!</p> <hr> <p>First of all, here is the website where you can see the form in action: <a href="http://www.energywisesolutions.ca/" rel="nofollow">http://www.energywisesolutions.ca/</a> </p> <p>You can click any 'Book a Home Evaluation' link/button to see the form slide open.</p> <hr> <p>This is the script I'm using for form validation: <a href="http://www.position-relative.net/creation/formValidator/" rel="nofollow">http://www.position-relative.net/creation/formValidator/</a></p> <hr> <p>Here is my form validation check, and then form send script:</p> <pre><code>$(document).ready(function() { /* ASSESSMENT FORM ----------------------------------------------------------------*/ // Form Validation $("#contact-form .send").click(function(){ $("#contact-form").validationEngine('attach', { onValidationComplete: function(form, status){ if(status==true){ $("#contact-form .send").clone().insertAfter($(this)).attr("disabled","true"); $("#contact-form .send").hide(); _gaq.push(['_trackPageview', '/online-thankyou']); $.post('/themes/energywise/mail-form/process.php', $("#contact-form").serialize(), function(data) { // Add Thank You Message $('#thank-you-message').html(data); // Create IFRAME to page with Adwords Tracking Script function ppcconversion() { var iframe = document.createElement('iframe'); iframe.style.width = '0px'; iframe.style.height = '0px'; document.body.appendChild(iframe); iframe.src = 'http://www.energywisesolutions.ca/themes/energywise/mail-form/conversion-script.php'; }; ppcconversion(); }); } } }); }); }); </code></pre> <p>And here is my form process script:</p> <pre><code>$toAdmin='info@energywisesolutions.ca'; $fromAdmin='info@energywisesolutions.ca'; $toVisitor=stripslashes($_POST['email']); $name=stripslashes($_POST['full_name']); $city=stripslashes($_POST['city']); $phone=stripslashes($_POST['phone']); $comments=stripslashes($_POST['comments']); /* TO ADMIN */ $headersToAdmin = "From: " .$toVisitor. "\r\n"; $headersToAdmin .= "Content-type: text/html; charset=iso-8859-1\r\n"; $subjectToAdmin='Energywise Website Lead - Home Assessment Form'; $messageToAdmin = '&lt;html&gt;&lt;body&gt;'; $messageToAdmin .= '&lt;img src="http://www.energywisesolutions.ca/energy-rebates/form1.jpg" alt="Home Assessment Form" /&gt;'; $messageToAdmin .= '&lt;p&gt;A website visitor has filled out thea Home Assessment Form. Here is their information and the comments they provided:&lt;/p&gt;'; $messageToAdmin .= '&lt;table rules="all" style="border-color: #666;" cellpadding="10"&gt;'; $messageToAdmin .= "&lt;tr style='background: #eee;'&gt;&lt;td&gt;&lt;strong&gt;Sent From:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;ENERGYWISE WEBSITE&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$name. "&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;City:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$city. "&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Email:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$toVisitor. "&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Phone:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$phone. "&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Comments:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$comments. "&lt;/td&gt;&lt;/tr&gt;"; $messageToAdmin .= "&lt;/table&gt;"; $messageToAdmin .= "&lt;/body&gt;&lt;/html&gt;"; /* TO VISITOR */ $headersToVisitor = "From: " .$fromAdmin. "\r\n"; $headersToVisitor .= "Content-type: text/html; charset=iso-8859-1\r\n"; $subjectToVisitor='Thank you for Contacting Energywise Solutions'; $messageToVisitor = '&lt;html&gt;&lt;body&gt;'; $messageToVisitor .= '&lt;img src="http://www.energywisesolutions.ca/energy-rebates/form1.jpg" alt="Home Assessment Form" /&gt;'; $messageToVisitor .= '&lt;p&gt;Hello,&lt;/p&gt; &lt;p&gt;Thank you for contacting Energywise Solutions. We have received your message and will get in touch with you shortly.&lt;/p&gt; &lt;p&gt;Your information has been attached below:&lt;/p&gt;'; $messageToVisitor .= '&lt;table rules="all" style="border-color: #666;" cellpadding="10"&gt;'; $messageToVisitor .= "&lt;tr style='background: #eee;'&gt;&lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$name. "&lt;/td&gt;&lt;/tr&gt;"; $messageToVisitor .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;City:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$city. "&lt;/td&gt;&lt;/tr&gt;"; $messageToVisitor .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Email:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$toVisitor. "&lt;/td&gt;&lt;/tr&gt;"; $messageToVisitor .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Phone:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$phone. "&lt;/td&gt;&lt;/tr&gt;"; $messageToVisitor .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Comments:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" .$comments. "&lt;/td&gt;&lt;/tr&gt;"; $messageToVisitor .= "&lt;/table&gt;"; $messageToVisitor .= "&lt;/body&gt;&lt;/html&gt;"; mail($toAdmin, $subjectToAdmin, $messageToAdmin, $headersToAdmin); mail($toVisitor, $subjectToVisitor, $messageToVisitor, $headersToVisitor); print "&lt;h3&gt;&lt;strong&gt;Thank you for contacting us.&lt;/strong&gt; We will get back to you as soon as possible.&lt;/h3&gt; &lt;p&gt;We have received your message and will get in touch with you shortly. If you have any immediate questions please feel free to give us a call. You can find the appropriate contact information for your region on our &lt;a href='/locations/'&gt;locations&lt;/a&gt; page.&lt;/p&gt;"; </code></pre> <p>Let me know if there's anything else you need to help me solve this issue. It's driving my clients and myself crazy. </p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload