Subscribe by email is getting lots of spam addresses even with double opt-in

Until about 2 weeks ago all was working fine.

Then suddenly I started receiving lots of subscribers through the plugin on my landing page. (Now I took it off.) even thought I have double opt-in enabled.

On August 16th I had 26 subscribers. Currently I have 327 subscribers, more than half confirmed. Addresses like 'gilemettehultzngx@' and 'info@2434e6f15cfece95.lolipop.jp', which are 99% spambots or similar.

Any idea why this is happening and how it can be stopped?

  • Milan

    Hello Andras

    Hope you are well today and thanks for asking us. :slight_smile:

    As plugin itself is quite simple and straight forward, it does not expose any default Anti Spam feature in it. Furthermore, there are some solution out there to stop Spaming which you may find useful,
    https://premium.wpmudev.org/blog/stop-wordpress-comment-spam/

    Though article is on comment spam, you'll get good idea about options to stop the spam out there. :slight_smile:

    I've also contacted our developer to know if there is something we can do here to help you out. As soon as I hear from him, I'll update you here.

    Till that time, let me know if you have anything else to ask. :slight_smile:
    Kind Regards,
    Milan

  • Milan

    Hello Andras

    Hope you are doing great today. :slight_smile:

    Our developer suggested this code to try out. :slight_smile:

    <?php
    
    add_filter( 'sbe_pre_subscribe_user', 'sbe_hooks_pre_subscribe_user', 10, 2 );
    function sbe_hooks_pre_subscribe_user( $subscribe, $email ) {
        if ( ! $subscribe ) {
            // We don't need to check
            return $subscribe;
        }
    
        $is_spam = sbe_hooks_is_spam( $email );
        if ( $is_spam || is_wp_error( $is_spam ) ) {
            return false;
        }
    
        return true;
    
    }
    
    function sbe_hooks_is_spam( $email ) {
        $result = false;
        if ( defined( 'AKISMET_VERSION' ) || function_exists( 'akismet_http_post' ) ) {
    
            global $akismet_api_host, $akismet_api_port;
    
            // data to be delivered to Akismet (This is what you need Modify this to your needs)
            $data = array(
                'comment_author'        => '',
                'comment_author_email'  => $email,
                'comment_author_url'    => 'spamming.com',
                'comment_content'       => 'my Spam',
                'user_ip'               => isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null,
                'user_agent'            => $_SERVER['HTTP_USER_AGENT'],
                'referrer'              => $_SERVER['HTTP_REFERER'],
                'blog'                  => home_url(),
                'blog_lang'             => get_locale(),
                'blog_charset'          => get_bloginfo( 'charset' ),
                //'permalink'             => '',
                'is_test'               => TRUE,
            );
    
            // Now we need to construct the query string
            $query_string = http_build_query( $data );
            // and then post it to Akismet
            $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
            // ..and check the results
            $result = false;
            if ( isset( $response[0]['x-akismet-pro-tip'] ) && 'discard' === trim( $response[0]['x-akismet-pro-tip'] ) && get_option( 'akismet_strictness' ) === '1' ) {
                $result = new WP_Error( 'feedback-discarded', __( 'Feedback discarded.', 'jetpack' ) );
            }
            elseif ( isset( $response[1] ) && 'true' == trim( $response[1] ) ) // 'true' is spam
            {
                $result = true;
            }
        }
    
        return $result;
    }

    And activate Akismet .Subscribe By Emails will check against Akismet when a user is subscribed.

    You can inject this code in your functions.php file but as its not able to persist change while theme update, please go for Mu Plugins

    Let me know how it goes. :slight_smile:
    Best Regards,
    Milan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.