Very strange error sending emails - Not able to understand if failed and when

Your software
My Mautic version is: 3.10
My PHP version is: 7.2

Your problem
I have queued 11.000 emails. Then I went to the server and I executed manually:
/usr/bin/php -q /var/www/clients/client1/web4/web/mautic/bin/console mautic:emails:send --no-interaction --no-ansi -vvv > err.log 2>&1

I got errors, not in log, but from console execution.
It is not clear to me how many emails have been sent to users, and either messages are warnings or have crashed console.
I’m not even able to find LoggerPlugin.php in the app

These errors are showing in the log (from execution):

In LoggerPlugin.php line 124:

Expected response code 250 but got code “503”, with message "503 5.5.1 Error: nested MAIL comma
Log data:
++ Starting Swift_Transport_EsmtpTransport
<< 220 ESMTP Postfix


250-SIZE 15728640
250 DSN


<< 334 VXNlcm5hbWU6


<< 334 UGFzc3dvcmQ6


<< 235 2.7.0 Authentication successful
Steps I have tried to fix the problem:
Wrote to the forum :slight_smile:

When I encounter this kind of error, the first thing I do is to check the mail logs, are you running your own mail server, if yes, then you can scan through the mail logs to investigate further.

The logs entry might be huge in that case, you can use grep or sed to filter out the possible range.

If you are not hosting your own mail server, then check the logs of wherever your mail server is hosted.

I have my own smtp server (postfix), but I think whatever the error messages coming from mail servers and reported from postfix, Mautic shouldn’t crash.
Moreover I’m not able to understand how many emails have been sent.

The answer to this will be in your postfix mail logs. An exception like this will stop Mautic from sending unless you modify the code in such a way that permits the process to skip the problem mail command.
The error means that the code is trying to send an email with several “ MAIL FROM” commands , which is not valid for SMTP server (there can be only one “ MAIL FROM” command for an email message).
This is generally caused by some sort of proxy which would appear in your ect/postfix/ or as something like -o content_filter=smtp-amavis:[]:10026 within the submission portion.
Antispam stuff, maybe even related to spam assassin depending on how its configured. Upon submission from Swift to Postfix you may be channeling mail submissions through the filter before it gets to Postfix and it rewrites or garbles the proper Mail From

If you have root access to your server check var/spool/postfix
In the postfix folder there will be folders like active, bounce, defer, deferred and so on. Most likely you will find the answer in there

Postfix is working well. We send 500k/day emails with it with other tools. We are trying to switch to Mautic.
My issue is that Mautic is crashing, while I would expect that it ignores wrong emails and goes on sending all others.
Sending emails to 300k business users, it’s quite common that some emails become invalid, but this shouldn’t invalidate the entire sending.
I think that there is a bug making Mautic crash, and I would like to find it and maybe solve it.
I am searching for some help to find the place where the bug is, as I don’t know Mautic source base.

Goto your configuration panel, under email-settings, here:

Screenshot the entire Mail Send Settings, or specifically, this section:

What do you have in that section.

I don’t think its a postfix issue per say either, but it is probably an issue of how swiftmailer submits the mail to postfix in its current configuration. I did research your log errors and those cases indicated the same. Its up to you if you want to explore that avenue.

I am keen to explore everything useful to solve.
could you please elaborate

how swiftmailer submits the mail to postfix in its current configuration.

what do you mean? Where should I search? Is it a matter of swiftmail configuration?
Thanks in advance for your help

You can research
"503 5.5.1 Error: nested MAIL command"

You can also post your: ect/postfix/ and ect/postfix/ if you are comfortable doing so to see if a configuration error can be spotted. The most helpful would be to post your var/log/maillog entries that occurred during this send.

I am investigating this issue.
I still think that no error message should crash Mautic, and that they should be logged and presented in a report of incorrect contacts.
Do you know where in the code are stored all possible erros?