How to setup a honeypot with wp_mail to reduce spam

Support MB Frontend Submission How to setup a honeypot with wp_mail to reduce spamResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35967
    JoeJoe
    Participant

    Hello,

    I am using the following code in a modal. Lately we are receiving a lot of spam, how can I setup a honeypot ? What kind of custom field do i have to use ? I have placed some ??????? where I am stuck.

    thank you very much for your help.

    <?php
    add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) {
        if ( 'nachricht' !== $config['id'] ) {
            return;
        }
    
        $deine_email = rwmb_meta( 'deine_email', '', $post_id );
        $dein_name = rwmb_meta( 'dein_name', '', $post_id );
        $dein_betreff = rwmb_meta( 'dein_betreff', '', $post_id );
        $deine_nachricht = rwmb_meta( 'deine_nachricht', '', $post_id );
        $honeypot = ????? ;
    
        //the spam honey pot
        if ($honeypot != '') {
                ???????
        }
    
        $attachments = array();
        $to [] = $deine_email;
        $subject = "XXX";  
        $body = "<p><b>Name</b>: $dein_name</p>
            <p>Email: $deine_email</p>
            <p>Nachricht: $deine_nachricht</p><br><br>
            <p>bla bla bla</p>";
        $headers = array(
            'Content-type: text/html; charset=UTF-8',
            'Reply-To:' . $deine_email . '',
            'From: abc Marcus <[email protected]>',
            'BCC: $deine_email');
    
        wp_mail($to, $subject, $body, $headers, $attachments );
     
    }, 10, 2 );
    ?>
    #35971
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please refer to this topic to create a honeypot field https://support.metabox.io/topic/honeypot-field/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.