• I’m using the PHP mail method with my form,

    but when I click on submit, the email is sent twice …

    I don’t why this happened

    my code works fine in the localhost without duplicating the email … so I think the problem is not in my code

    Note: I’m using PHPcode Snippet plugin in the WordPress to add the PHP code in my WordPress page

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @ahmedsana1998

    Add condition like this,

    if(mail($to, $subject, $message, $headers)){
                    header('Location: contactez-nous.php?CaptchaPass');
    
        }else{
            echo "mail could not be sent";
        }

    Hope this will be helpful for you, and let me know if it’s work your

    Thanks

    Thread Starter ahmedsana1998

    (@ahmedsana1998)

    Hi,

    Thank you for your response,

    unfortunately, it didn’t work

    this is my code for sending mail

        if (mail($mailto, $subject_from_web, $message_fromCustomer, $header_ToWebOwner)&& mail($from, $subject_confirmation, $message_AutoReplay_ToClient, $headers_ToClient)) {
    			 header('Location: contactez-nous.php?CaptchaPass');
            echo '<script type="text/javascript">successFunction("Message was sent successfully, check your emails!");</script>';
        } else {
            echo '<script type="text/javascript">failedFunction("Mail was not sent, Try again!.");</script>';
        }
    Thread Starter ahmedsana1998

    (@ahmedsana1998)

    Hello again,

    There are Any Updates?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Mail method sent mail twice’ is closed to new replies.