Friday, May 13, 2016

Contact Form 7 Error s Part 1


 “Failed to send your message”. 

There could be two causes for this. The first is actual mail server trouble, where email cannot be sent. In this case, the error message would be surrounded with a RED border line. Contact your server admin.
The second possible cause is that the form submission is under suspicion of spam. In this case, the error message would be surrounded with an ORANGE borderline.

An error messages with a red border

The red border means that Contact Form 7 tried to send mail with wp_mail(), but it failed. To solve the issue, you need to find out the actual reason why it is failing in the first place.
There could be various reasons such as the mail setup wasn’t valid.
The sending would also fail if the mail server was down, inaccessible or be experiencing other problems. In this case, it will be more difficult to solve the issue by yourself. I would suggest you contact your host for support. They may be able to check the error logs to find out the reason for the failure.
In some cases, it is possible to solve this issue by using another mail server. Postman SMTP is one of the plugins that will help you do that.

 “Your message was sent successfully” with a green border, but  never receive a mail for that.

Showing the green border message means that the PHP function for sending the mail has certainly completed successfully. So if you can’t receive the mail, it’s highly possible that the mail has been kidnapped or killed after that.
If you can check the log of your mail server, it could give you some clues. Spam filter often causes this kind of problem.

Best Practice to Set Up Mail

Setting up mail (header and message) properly is essential for successful mail delivery. In this article, I’ll describe how you can properly set up mail to maximize mail deliverability.

Avoid looking like spam

Mail service providers have been fighting relentless mail abuses like spam and spoofing. Since anti-abuse techniques aren’t flawless, there is always a possibility of false-positives; even if you are not a real spammer, behaving like a spammer can increase the likelihood of being treated that way.
Specify Reply-to Address
When you reply to email, the reply is normally sent to the address specified in the From field of the original mail. What if you didn’t want to receive replies at the From address?
Prepare a real “WordPress” email address
It is recommended you prepare a real wordpress@{your-site-domain} address on your host. Because the default mail template of Contact Form 7 (v4.0 and later) uses this address in its From field, someone might try to send mail to this address. Some hosts also block outgoing mail from this address if it doesn’t exist.
Utilize email authentication
Even if you set an email address belonging in the site domain in the From field, spammers can still send spoofed mail as if you sent it from your domain. As long as the possibility of email spoofing exists, the risk of mail service providers confusing your legitimate mail for spoofed mail remains.
Make sure you have appropriate values in mail fields
Be careful when using values from optional form input fields. Are your mail header fields valid even when the values are empty?
Also, be careful not to make the message body empty or too short. It not only makes the mail look like spam, it makes mail sending function fail on some hosts.