• Resolved kattouf

    (@kattouf)


    I am using your plugin together with Sendgrid. all good and love it.

    Issue we are facing is that SOMETIMES when user submit contact form on website duplicate copies are sent. (doesn’t happen with woocommere emails)

    I can see that using a Mail Log Plugin.

    The code for sending is this:
    wp_mail( $to, $subject . rand(0,1000000), $body, $headers ))

    I put a rdn number in subject to help trouble shoot. and each sent email has different number. So that code is being run twice. I tried to put Die() is several places but it doesn’t help.

    sample of code:

    $i=1;
    if ($i != 1)
    {
    die();
    }
    if(wp_mail( $to, $subject . rand(0,1000000), $body, $headers )){
    echo json_encode(array(‘status’=>’success’));
    die();
    $i++;
    } else {
    echo json_encode(array(‘status’=>’error’));
    }
    die();

    }

    It might not be an issue with your plugin but i had to ask, could also be the javascript trigger we have or other things. if you have an idea please suggest.

    /J

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @kattouf,

    Thanks for reaching out. The sample code you’ve shared should not send duplicate emails, so there is possibly something else in your codes that you’ve not shared here going wrong. For technical issues, you might want to post in forums such as Stack Overflow unless the issue is specific to WP Mail SMTP.

    Have a good one!

    Thread Starter kattouf

    (@kattouf)

    Hello,

    thanks for reply,

    I ended up Disabling the submit button onclick. I think that resolved it.

    thank

    /J

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘duplicate/triple emails sent’ is closed to new replies.