• We’ve been encountering an issue with the Contact Form 7 plugin on our site. Occasionally, duplicate emails are being delivered when users submit the form. While it doesn’t happen consistently, it’s still a concern for us. Has anyone else experienced this issue, and if so, how did you resolve it?

    Details:
    Duplicate emails are sporadically sent to the recipient when users submit the Contact Form 7.


    The issue is not consistently reproducible, making it challenging to pinpoint the cause.


    Our Setup:
    WordPress version: Version 6.4.3 – Custom theme
    Contact Form 7 version: Version 5.9.3
    Here are the plugins that were being used that interact with CF7. However, all have been deactivated EXCEPT ACF, but the issue remains:

    Akismet
    Contact Form CFDB7
    Honeypot for Contact Form 7
    Redirection for Contact Form 7
    Advanced Custom Fields PRO

    We’ve checked for any misconfigurations within the Contact Form 7 settings.


    Reviewed server logs for any anomalies related to email delivery.

    Thanks,

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    We’ve run into the same issue. It’s typically caused when the user mashes the submit button (clicks it multiple times before the form submission is complete). I used a JavaScript workaround that disables the submit button if the form is submitted, but re-enables it if the submission failed. You can use the following javascript in the footer of your theme and it will work for all contact forms created with CF7 that are on your WordPress site ??

    <script>
    document.addEventListener('DOMContentLoaded', () => {
        const eotmForm = document.querySelector('form.wpcf7-form');
        const submitButton = eotmForm.querySelector('input[type="submit"].wpcf7-submit');
    
        eotmForm.addEventListener('submit', () => {
            submitButton.disabled = true;
        });
    
        const observer = new MutationObserver((mutations) => {
            mutations.forEach((mutation) => {
                if (mutation.type === 'attributes' && mutation.attributeName === 'data-status') {
                    const status = eotmForm.getAttribute('data-status');
                    if (status === 'invalid') {
                        submitButton.disabled = false;
                    }
                }
            });
        });
        observer.observe(eotmForm, {
            attributes: true
        });
    });
    </script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sporadic Duplicate Emails’ is closed to new replies.