I see same issue and message:
“Failed to send your message. Please try later or contact the administrator by another method.”
PHP: 7.3.3
cURL Host: x86_64-redhat-linux-gnu
cURL SSL Version: OpenSSL/1.0.2r
cURL libz Version: 1.2.7
{
“into”: “#wpcf7-f1525-o2”,
“status”: “spam”,
“message”: “Failed to send your message. Please try later or contact the administrator by another method.”
}
-
This reply was modified 7 years, 2 months ago by
parvez2. Reason: added additional log
One issue that has been preventing CF7 mail from being sent on our systems is related to the CF7 POST URL lacking a trailing slash:
POST https://<domain>/wp-json/contact-form-7/v1/contact-forms/196/feedback
301 Moved permanently > https://<domain>/wp-json/contact-form-7/v1/contact-forms/196/feedback/
404 Not found https://<domain>/wp-json/contact-form-7/v1/contact-forms/196/feedback/
Trailing slashes are automatically added on our systems so this causes a problem. It would be nice if CF7 could add a trailing slash to their POST URL’s so that the URL structure is consistent throughout WordPress.
One other tip: we are also using Sendgrid to send email, on our systems the official Sendgrid WordPress plugin seems to work better than WP Mail SMTP.
Thread Starter
Nate1
(@nate1)
The issue is that I’ve removed the user agent using varnish, however it doesn’t alert to the problem which is a little frustrating.
`switch ( $submission->get_status() ) {
case ‘validation_failed’:
….
case ‘spam’:
$class .= ‘ wpcf7-spam-blocked’;
break;`
Tracking that down, If theres no user agent the mail gets marked as spam. Standardized requests in varnish means this isn’t very desirable – is it possible this could be configurable?
private function spam() {
$spam = false;
....
$user_agent = (string) $this->get_meta( 'user_agent' );
if ( strlen( $user_agent ) < 2 ) {
$spam = true;
}
if ( ! $this->verify_nonce() ) {
$spam = true;
}
if ( $this->is_blacklisted() ) {
$spam = true;
}
return apply_filters( 'wpcf7_spam', $spam );
}
As a workaround, instead of just
unset req.http.User-Agent;
I’ve added
set req.http.User-Agent = "x-varnish";
Which allows it to sidestep the spam validation whilst standardizing all requests.
The varnish installs are the latest versions, and though plesk etc was the same on the old server the varnish was vcl3.0 and didn’t have a clause set for the user agent.
-
This reply was modified 7 years, 2 months ago by
Nate1.