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
nd
"
Log data:
++ Starting Swift_Transport_EsmtpTransport
<< 220 mail-fast1.merqurio.net ESMTP Postfix

EHLO ma.dottnet.it

<< 250-mail-fast1.merqurio.net
250-PIPELINING
250-SIZE 15728640
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

AUTH LOGIN

<< 334 VXNlcm5hbWU6

bm9yZXBseUBuZXdzbGV0dGVyLm1lcnF1cmlvLm5ldA==

<< 334 UGFzc3dvcmQ6

VDRiUTZoWWVqUA==

<< 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/master.cf or main.cf as something like -o content_filter=smtp-amavis:[127.0.0.1]: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: https://domain.com/s/config/edit#emailconfig

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/master.cf and ect/postfix/main.cf 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?

Hi there. I have encountered the same error message. I set up the account with Amazon SES but they gave me trouble with moving out of the sandbox. I then contracted an smtp with our hosting and tried to send test emails and campaigns. It looks like somewhere in the process (probably because of having two mx10 records in the DNS entries) a second Email from record was added to my Mautic installation. I have tested it all and the problem only exists on this particular installation. It would have been very useful for me to find some documentation about where to modify the email from record. I had to do a backup instead which made me lose quiet some progress.

Btw clearing the cache didn´t help in this case