SMTP temp failure causes "Call to undefined method CRM_Utils_Mail_FilteredPearMailer::disconnect()"
SMTP temp fails can result in "Call to undefined method CRM_Utils_Mail_FilteredPearMailer::disconnect()"
This involves SMTP temp fails so is not easy to reproduce reliably.
The error seen in the log is:
SMTP Socket Error or failed to set sender error. Message: Failed to set sender: email@example.com [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: 421, response: 4.7.0 Try again later, closing connection. (MAIL) f22sm5685077lja.39 - gsmtp)], Code: 10004
The mailing was initiated with
cv api Job.execute producing:
Call to undefined method CRM_Utils_Mail_FilteredPearMailer::disconnect()
The problem seems to be here: https://github.com/civicrm/org.civicrm.flexmailer/blob/master/src/Listener/DefaultSender.php#L77
- Change flexmailer not to call
Also, the error message is misleading: a 421 or 4.7.0 is not an invalid response and was not caused but settings misconfiguration.
This seems to be a fairly minor problem in that it only occurs for temp fails and those are retried later.
- CiviCRM: 5.24.4
- Flexmailer: 1.1.1
- PHP: 7.2
- Mail configuration: SMTP to gmail.com