After updating to 5.40.2 (running with Wordpress 5.8 on CentOS with CPanel), I cannot send anymore e-mails with SMTP and Gmail.

Using smtp.gmail.com and port 587 as I have always done returns: STARTTLS failed.

Using smtp.gmail.com and port 465 returns, when sending a test email:

Failed to connect to smtp.gmail.com:465 [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP). (code: -1, response: )]

Using ssl:// has never worked for me and isn't working now (it returns fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) or fsockopen(): unable to connect to ssl://smtp.gmail.com:587 (Unknown error)).

openssl s_client -connect smtp.gmail.com:465 and openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:587 seem to work, so I don't think that's a firewall problem.

Any ideas? Thanks in advance.

1 Answer 1


What version did you upgrade from? You may have to set up CRED_KEYS in civicrm.settings.php. See https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-534

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.