Hi @ngreenstein ,
Thanks for reaching out.
Ideally, the error that you have shared indicates an issue with your server, specifically related to the cURL library installed. At the moment, the easiest way would be updating/adjusting the cURL library on this case.
To learn more about the issue, please refer to this guide. Please contact your web hosting support and provide them with the full error. They should be able to assist you by updating the cURL library on your server or adjusting server settings to resolve the timeout issue.
I hope this helps. Thanks 🙂
Thank you, @shawon001, for your quick reply and for the link.
I have confirmed that there are no firewall or other plugin issues, and that curl is up to date. Although it is true that the host’s configured timeout is fairly low, all other site functions are working as intended; it is only requests sent from WP Mail SMTP which are timing out.
Because the server configuration works as desired otherwise, I am wondering if it is possible to pass a custom timeout parameter to the plugin. Is there any interface to do this, either in the admin panel, or via a filter or similar?
Thank you!
Hi @ngreenstein ,
Thanks for the follow up.
Here is a custom code snippet that allows to set curl options only for particular request-
/ Increase CURL timeout for WP Mail SMTP SMTP2GO mailer requests.
add_action( 'http_api_curl', function( $handle, $r, $url ) {
if ( strpos( $url, 'api.smtp2go.com' ) !== false ) {
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 10 ); // seconds
curl_setopt( $handle, CURLOPT_TIMEOUT, 30 ); // seconds
}
}, 10, 3 );
In case it helps, here’s a tutorial with the most common ways to add custom code like this.
For the most beginner-friendly option in the guide above, I’d recommend using the WPCode plugin. This will protect your code from updates and keep it easy to manage right within your WordPress admin area.
I hope this helps. Thanks!