1

Emails in CiviMail are bouncing with the following error message:

Failed to set sender: [email protected] [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 Admi

Outbound email settings are good and test emails sent from there work.

Taking a cue from this post, I looked at "Administer - CiviMail - Mail Accounts."

When using IMAP there, I get the following error:

An error occured while sending or receiving mail. Failed to connect to the server: my.example.com:143. (See log for more details.)

The log is as follows:

Apr 14 06:41:17  [warning] MailSettings: Failed to establish test connection
Array
(
    [exception] => ezcMailTransportException: "An error occured while sending or receiving mail. Failed to connect to the server: my.example.com:143."
#0 /app/data/wp-content/plugins/civicrm/civicrm/vendor/zetacomponents/mail/src/transports/imap/imap_transport.php(403): ezcMailTransportConnection->__construct()
#1 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Imap.php(58): ezcMailImapTransport->__construct()
#2 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore.php(76): CRM_Mailing_MailStore_Imap->__construct()
#3 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore.php(53): CRM_Mailing_MailStore::{closure}()
#4 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Action/MailSettings/TestConnection.php(28): CRM_Mailing_MailStore::getStore()
#5 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicBatchAction.php(92): Civi\Api4\Action\MailSettings\TestConnection->doTask()
#6 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicBatchAction.php(75): Civi\Api4\Generic\BasicBatchAction->processBatch()
#7 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(72): Civi\Api4\Generic\BasicBatchAction->_run()
#8 /app/data/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(158): Civi\Api4\Provider\ActionObjectProvider->invoke()
#9 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(250): Civi\API\Kernel->runRequest()
#10 /app/data/wp-content/plugins/civicrm/civicrm/api/api.php(85): Civi\Api4\Generic\AbstractAction->execute()
#11 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/MailSettings.php(214): civicrm_api4()
#12 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(573): CRM_Admin_Form_MailSettings->postProcess()
#13 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(152): CRM_Core_Form->mainProcess()
#14 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(119): CRM_Core_QuickForm_Action_Upload->realPerform()
#15 /app/data/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform()
#16 /app/data/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle()
#17 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle()
#18 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(334): CRM_Core_Controller->run()
#19 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(140): CRM_Core_Page_Basic->edit()
#20 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Core_Page_Basic->run()
#21 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#22 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#23 /app/data/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke()
#24 /app/code/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke()
#25 /app/code/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#26 /app/code/wp-includes/plugin.php(517): WP_Hook->do_action()
#27 /app/code/wp-admin/admin.php(259): do_action()
#28 {main}

)

(This is not surprising as my server uses a different port for IMAP, but I'm not sure where to change that in CiviCRM.)

However, the connection succeeds when the Maildir protocol is selected.

I'm not sure if "Administer - CiviMail - Mail Accounts" has anything to do with the bounces in CiviMail, but any help regarding next steps is appreciated.

Using CiviCRM 5.57.0 with Wordpress 6.2.

2
  • There is definitely an issue with your inbound server setup. Whether that is also preventing sending is hard for me to say, but it is conceivable. I can't find docs on setting a custom port, but I would try adding it via a colon at the end of the server line like this: mail.server.com:1234
    – kapn
    Commented Apr 14, 2023 at 15:03
  • Thank you. Adding the port did change the error message which now reads: "An error occured while sending or receiving mail. The connection to the IMAP server is ok, but a negative response from server was received. Try again later. (See log for more details.)" Commented Apr 14, 2023 at 16:57

1 Answer 1

3

Turns out I needed to enable masquerading on my server which "allows users and apps to send emails with an arbitrary username in the FROM address."

I am now able to send through CiviMail.

I thought of this as the tail end of the error message was:

(code: 550, response: Authenticated user [email protected] cannot send mail as [email protected])

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.