SwiftMailer Error: Cannot Send Message Without Sender Address

Your software
My Mautic version is:3.0
My PHP version is:7.3

Your problem
My problem is: Executed cron: bin/console swiftmailer:spool:send -vvv and received this error

These errors are showing in the log:Exception trace:
at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:124
Swift_Plugins_LoggerPlugin->exceptionThrown() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php:139
Swift_Events_SimpleEventDispatcher->bubble() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php:119
Swift_Events_SimpleEventDispatcher->dispatchEvent() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:432
Swift_Transport_AbstractSmtpTransport->throwException() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/c lasses/Swift/Transport/AbstractSmtpTransport.php:195
Swift_Transport_AbstractSmtpTransport->send() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php:169
Swift_FileSpool->flushQueue() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/swiftmailer-bundle/Command/SendEmailCommand.php :119
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->recoverSpool() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/swi ftmailer-bundle/Command/SendEmailCommand.php:90
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->processMailer() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/sw iftmailer-bundle/Command/SendEmailCommand.php:67
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->execute() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/console/ Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/framework-bundle/Console/Application.php:86
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/console/Ap plication.php:255
Symfony\Component\Console\Application->doRun() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/framework-bundle/Console/Application.php:74
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/vendor/symfony/console/Applicati on.php:148
Symfony\Component\Console\Application->run() at /var/www/vhosts/Mautic-Install.com/hub.Mautic-Install.com/bin/console:43

swiftmailer:spool:send [–message-limit MESSAGE-LIMIT] [–time-limit TIME-LIMIT] [–recover-timeout RECOVER-TIMEOUT] [–mailer MAILER] [–transport TRANSP ORT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

Steps I have tried to fix the problem: Searched support, verified mail setting in configuration and tested. Cleared cache, looked at similar issues on StackOverflow

Your software
My Mautic version is:3.0
My PHP version is:7.3

Your problem
My problem is:
In LoggerPlugin.php line 124:

Cannot send message without a sender address
Log data:
++ Starting Swift_Transport_EsmtpTransport
<< 220 myHost.com ESMTP Postfix

EHLO hub.mydomain.com

<< 250-myhost.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING

STARTTLS

<< 220 2.0.0 Ready to start TLS

EHLO hub.mydomain.com

<< 250-myHost.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING

AUTH LOGIN

<< 334 VXNlcm5hbWU6

aW5mb0B0ZWNocGhlbm9tZW5vbi5jb20=

<< 334 UGFzc3dvcmQ6

RGlhYmxvdGVrMTk3OA==

<< 235 2.7.0 Authentication successful

++ Swift_Transport_EsmtpTransport started
!! Cannot send message without a sender address (code: 0)

swiftmailer:spool:send [–message-limit MESSAGE-LIMIT] [–time-limit TIME-LIMIT] [–recover-timeout RECOVER-TIMEOUT] [–mailer MAILER] [–transport TRANSPORT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

These errors are showing in the log: listed above

Steps I have tried to fix the problem: cleared cache restarted postfix & dovecot and threw a silver dollar down a wishing well

I have merged these two as they seem to be on the same topic.

I found an old closed issue here: https://github.com/mautic/mautic/issues/2960 but not hugely informative.

Some questions to help with troubleshooting:

  1. Can you send test emails from the email settings when you set up the provider?
  2. Are you able to send individual emails at all (eg direct to contact without a campaign)?
  3. When you are sending the emails, what are you using for the ‘from’ settings in your global config
  4. Are you setting anything at the email level to override the global settings?
  5. Have you got sender as owner enabled? If so has the contact got an owner assigned?

Test email setting and sending test emails are fine
From settings in configuration are the same as actual email credentials. No alias or anything used
No overrides to global settings
Sender as owner is set to no

Note: When i turned off queue sending the problem persists same as when queue sending is on

quick update. I can manually send emails to a segment no problem. The campaign emails are the ones failing

Ok, can you share the Cron jobs that you are using to process the queue?

Can you also please share the configuration you have got set for the campaign where you are sending an email? Just set up a basic one if that helps with just the send email action.

Are you sending them as regular emails, or marketing messages?

messages are marketing messages

/bin/console mautic:emails:send <—fails

When using /bin/console swiftmailer:email:send the test message
/bin/console mautic:campaigns:messages --channel=email sends
/bin/console mautic:broadcasts:send --channel=email

Some pending emails send

When using /bin/console swiftmailer:spool:send -vvv

Exception trace:
at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php:124
Swift_Plugins_LoggerPlugin->exceptionThrown() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php:139
Swift_Events_SimpleEventDispatcher->bubble() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php:119
Swift_Events_SimpleEventDispatcher->dispatchEvent() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:432
Swift_Transport_AbstractSmtpTransport->throwException() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:195
Swift_Transport_AbstractSmtpTransport->send() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php:169
Swift_FileSpool->flushQueue() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/swiftmailer-bundle/Command/SendEmailCommand.php:119
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->recoverSpool() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/swiftmailer-bundle/Command/SendEmailCommand.php:90
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->processMailer() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/swiftmailer-bundle/Command/SendEmailCommand.php:67
Symfony\Bundle\SwiftmailerBundle\Command\SendEmailCommand->execute() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/framework-bundle/Console/Application.php:86
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/framework-bundle/Console/Application.php:74
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/www/vhosts/where-mautic-is-installed.com/hub.where-mautic-is-installed.com/bin/console:43

swiftmailer:spool:send [–message-limit MESSAGE-LIMIT] [–time-limit TIME-LIMIT] [–recover-timeout RECOVER-TIMEOUT] [–mailer MAILER] [–transport TRANSPORT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

@EJL From the logs I understand that you’re using your own SMTP server to send emails, is that correct? I’m suspecting Mautic to incorrectly set the sender address in this case, but we’ll need to do some more troubleshooting to see what the culprit is.

I’m assuming you have a value in the “E-mail address to send mail from” field, right?

@dennisameling
in name to send mail as - a first and last name
in email address to send from - an email address
rest of the settings are smtp credentials
testing connections = success
sending test email = success

reviewing /app/bundles/emailbundle/config/config.php i find this with SMTP being indicated transport but most variables “null”

‘parameters’ => [
‘mailer_api_key’ => null, // Api key from mail delivery provider.
‘mailer_from_name’ => ‘Mautic’,
‘mailer_from_email’ => ‘email@yoursite.com’,
‘mailer_return_path’ => null,
‘mailer_transport’ => ‘smtp’,
‘mailer_append_tracking_pixel’ => true,
‘mailer_convert_embed_images’ => false,
‘mailer_host’ => ‘’,
‘mailer_port’ => null,
‘mailer_user’ => null,
‘mailer_password’ => null,
‘mailer_encryption’ => null, //tls or ssl,
‘mailer_auth_mode’ => null, //plain, login or cram-md5
‘mailer_amazon_region’ => ‘email-smtp.us-east-1.amazonaws.com’,
‘mailer_custom_headers’ => ,
‘mailer_spool_type’ => ‘memory’, //memory = immediate; file = queue
‘mailer_spool_path’ => ‘%kernel.root_dir%/…/var/spool’,
‘mailer_spool_msg_limit’ => null,
‘mailer_spool_time_limit’ => null,
‘mailer_spool_recover_timeout’ => 900,
‘mailer_spool_clear_timeout’ => 1800,
‘unsubscribe_text’ => null,
‘webview_text’ => null,
‘unsubscribe_message’ => null,
‘resubscribe_message’ => null,
‘monitored_email’ => [
‘general’ => [
‘address’ => null,
‘host’ => null,
‘port’ => ‘993’,
‘encryption’ => ‘/ssl’,
‘user’ => null,
‘password’ => null,
‘use_attachments’ => false,
],
‘EmailBundle_bounces’ => [
‘address’ => null,
‘host’ => null,
‘port’ => ‘993’,
‘encryption’ => ‘/ssl’,
‘user’ => null,
‘password’ => null,
‘override_settings’ => 0,
‘folder’ => null,
],
‘EmailBundle_unsubscribes’ => [
‘address’ => null,
‘host’ => null,
‘port’ => ‘993’,
‘encryption’ => ‘/ssl’,
‘user’ => null,
‘password’ => null,
‘override_settings’ => 0,
‘folder’ => null,
],
‘EmailBundle_replies’ => [
‘address’ => null,
‘host’ => null,
‘port’ => ‘993’,
‘encryption’ => ‘/ssl’,
‘user’ => null,
‘password’ => null,
‘override_settings’ => 0,
‘folder’ => null,
],
],
‘mailer_is_owner’ => false,
‘default_signature_text’ => null,
‘email_frequency_number’ => 0,
‘email_frequency_time’ => ‘DAY’,
‘show_contact_preferences’ => false,
‘show_contact_frequency’ => false,
‘show_contact_pause_dates’ => false,
‘show_contact_preferred_channels’ => false,
‘show_contact_categories’ => false,
‘show_contact_segments’ => false,
‘mailer_mailjet_sandbox’ => false,
‘mailer_mailjet_sandbox_default_mail’ => null,
‘disable_trackable_urls’ => false,
],
];

Anyone have any insight? Testing procedures I should try?

I have this setting in 3.1, and it works for me:
‘mailer_amazon_region’ => ‘us-east-1’,

Maybe it’s not relevant. Just saying.

Since the update mine is the same. I was hoping @rcheesley or @dennisameling could revisit this. It has once again brought me to a halt.

Have you checked the Amazon email config options? There were some changes that came with 3.2 so you might need to update your settings / reconfigure if there are some issues. Worth taking a look at least. Try setting it to some other setting, and then re-configuring the Amazon settings?

I dont use amazon, I have my own SMTP server… The amazon region was mentioned as a potential default setting that needed to be changed.

Ah sorry, I misunderstood. Will have a look through issues and see if there’s anything that has been raised!

Testing earlier:
When email delivery set to queued- test email gets thrown in spool. CLI command and manual execution of cron results in error above.
When email delivery is set to immediate. It send no problem.