• Resolved ngreenstein

    (@ngreenstein)


    Good morning,

    I have just configured WP Mail SMTP Lite, with SMTP2GO as my mailer. All is working well and emails are sent as desired. However, each email is marked as failed, with the error message copied below, despite successful delivery. As a workaround, I have increased my global WP values for CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT. This resolves the false error flags.

    However, I would prefer to leave the site’s global settings alone and make an exception for WP Mail SMTP. Is there any interface exposed to do this?

    Thank you!

    Error: http_request_failed: ["cURL error 28: Operation timed out after 1000 milliseconds with 0 bytes received"]

    Source: /wp-content/plugins/wp-mail-smtp/src/Admin/Pages/TestTab.php (line: 350)

    • This topic was modified 10 months, 4 weeks ago by ngreenstein.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Shawon Chowdhury

    (@shawon001)

    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 🙂

    Thread Starter ngreenstein

    (@ngreenstein)

    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!

    Plugin Support Shawon Chowdhury

    (@shawon001)

    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!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Possible to set custom cURL timeout?’ is closed to new replies.