'Contact Form 7 mails are being marked like spam

All the mails sent from a Contact Form 7 form are being marked by gmail as spam.

A hint: I looked at the option "Show Original" and I found stuff like this:

Return-Path: <www-data@localhost>
....
Received-SPF: none (google.com: www-data@localhost does not designate permitted sender hosts) client-ip=178.216.103.114;
....
Authentication-Results: mx.google.com;
   spf=neutral (google.com: www-data@localhost does not designate permitted sender hosts) smtp.mail=www-data@localhost;
   dmarc=fail (p=NONE dis=NONE) header.from=gmail.com

See all thos www-data@localhost ? My guess is that they have something to do with the problem (but I could be wrong).

What could I do to solve this problem on the server side?



Solution 1:[1]

This is a common issue with Contact Form 7 and some php mail or server settings on some hosts.

Try hardcoding the sender name in the ‘From:’ field in the ‘Mail’ section like Webmail <[email protected]> This means you won't see the sender name or email as names and return emails in your incoming mail box, but that doesn't matter much, as the sender's email will be in the body of the message.

If that doesn't work, try https://wordpress.org/plugins/wp-mail-smtp/ to use SMTP instead of php mail.

And see http://contactform7.com/faq/ and http://buzztone.com.au/contact-form-7-email-issues/

Solution 2:[2]

This can be solved via using "WP Mail SMTP" plugin which is for enabling SMTP auth in wordpress. Just install the plugin via wordpress admin or download and extract the plugin zip file to wordpres plugins folder. Correct permissions.

Activate "WP-Mail-SMTP" plugin in wordpress admin >> Plugins. Then go to Wordpress Admin >> Settings >> Email

Enter your email settings as mentioned in the screen shot. Make sure you have turned ON "Use SMTP authentication". If you are using remote MX, specify the remote MX instead of "localhost" in SMTP Host.

enter image description here

Solution 3:[3]

This month i had the same problem, after suffering for two weeks I found the problem. The WordPress default CONFIG -> DISCUSSION is applying the disallowed words list to the CF7 forms.

Try adding this code snippet to your child 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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 markratledge
Solution 2 nisamudeen97
Solution 3 Sarah