Symptoms

Cannot send email through Contact Form when "Enable the protection from automated spam postings" is enabled (with Captcha). The following error popups:

Your message could not be sent due to an internal error. Please contact the website administrator by other means to notify about this issue

The message is sent successfully when Captcha is disabled.

Cause

Tail error.log on WPB server (where website exists). You'll see that host www.google.com is not resolving from WPB server:

# tail -f error_log
PHP Warning:  fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /PATH/TO/SITE/modules/contact/send.php on line 116
PHP Warning:  fsockopen(): unable to connect to www.google.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /PATH/TO/SITE/modules/contact/send.php on line 116

or

# tail -f error_log
PHP Warning:  fsockopen(): unable to connect to www.google.com:80 (Connection refused) in /PATH/TO/SITE/modules/contact/send.php on line 116
PHP Warning:  fsockopen(): unable to connect to www.google.com:80 (Connection refused) in /PATH/TO/SITE/modules/contact/send.php on line 116

Resolution

Add IP address of www.google.com in /etc/hosts:

/etc/hosts

173.194.71.104   www.google.com

Internal content