Rob Paddock
Rob Paddock

Reputation: 1003

Contact form 7 will not email form due to it thinks its SPAM

I have a client that has upgraded wordpress to 3.7.1. Contact Form 7 now reports all forms as SPAM. I have WP-Mail installed and all was working before. Any ideas on how to fix this. Does anyone know where in the plugin code the form is getting marked as spam

Thanks

Upvotes: 3

Views: 20534

Answers (6)

Руслан
Руслан

Reputation: 1

try to change private $skip_spam_check = true in contact-form-7\includes\submission.php If you have google captcha turn of Cf7 spam check.

private static $instance;

private $contact_form;
private $status = 'init';
private $posted_data = array();
private $posted_data_hash = null;
private $skip_spam_check = true;
private $uploaded_files = array();
private $skip_mail = false;
private $response = '';
private $invalid_fields = array();
private $meta = array();
private $consent = array();
private $spam_log = array();

Upvotes: 0

Vinay
Vinay

Reputation: 7

Just add below line in functions.php

add_filter('wpcf7_spam' function() { return false; });

Upvotes: -1

cooler
cooler

Reputation: 163

If you use recaptcha make sure reCAPTCHA’s script file is loaded: https://contactform7.com/faq-about-recaptcha-v3/#response-token-is-empty

Upvotes: 0

Sarah
Sarah

Reputation: 56

I was having the same problem this month and I managed to figure it out. The default CONFIG -> DISCUSSION is applying the disallowed words list to the CF7 forms.

Try adding this code snippet to your theme functions.php file:

/**
 * CONTACT FORM 7
 * Disable WP Disallowed List for SPAM validation
 */
add_filter( 'wpcf7_submission_has_disallowed_words', '__return_false', 10, 2 );

It worked for me.

Upvotes: 0

Con
Con

Reputation: 91

Thanks. I used this to amend this.

// a) Did not work for me. 
add_filter('wpcf7_spam', '__return_false');
 
// b) There is another filter for the boolean used in the control statement. 
add_filter('wpcf7_skip_spam_check', '__return_true');

Upvotes: 7

Manchumahara
Manchumahara

Reputation: 157

I think this issue happens when we use 3rd party service like sparkpost for sending email or something like that. I tried to check code base how cf7 check spam and found contact-form-7\includes

then submission.php file, check the code near or search with keyword "spam()"

elseif ( $this->spam() ) { // Spam!
        $this->status = 'spam';
        $this->response = $contact_form->message( 'spam' );
}

I think besides the wordpress core blacklist checking it also check the sender domain name and bla bla and mark any valid form submission as spam. So I made the spam checking commented.

This is not a permanent solution but it will help for now.

Upvotes: 1

Related Questions