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

**URL:** https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656
**Category:** Product Support
**Created:** [October 20, 2020, 4:58pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656 "2020-10-20T16:58:53Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 20, 2020, 4:58pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/1 "2020-10-20T16:58:53Z")

</div>

**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](http://mail-fast1.merqurio.net) ESMTP Postfix

> > EHLO ma.dottnet.it

\<\< [250-mail-fast1.merqurio.net](http://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 🙂

---

<div class="post-metadata">

### Author: ![devsrealm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/devsrealm/32/3669_2.png) [@devsrealm](https://forum.mautic.org/u/devsrealm)
#### Post date: [October 20, 2020, 11:46pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/2 "2020-10-20T23:46:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 21, 2020, 9:23am UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/3 "2020-10-21T09:23:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)
#### Post date: [October 21, 2020, 12:11pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/4 "2020-10-21T12:11:28Z")

</div>

> [@alfmos](#):
>
> Expected response code 250 but got code “503”, with message "503 5.5.1 Error: nested MAIL command

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**

> [@alfmos](#):
>
> Moreover I’m not able to understand how many emails have been sent.

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

 ![Screenshot (37)](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/be13bb08d623a6ae3460816aa99b91a78a084a9d.png)

---

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 27, 2020, 9:12am UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/5 "2020-10-27T09:12:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![devsrealm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/devsrealm/32/3669_2.png) [@devsrealm](https://forum.mautic.org/u/devsrealm)
#### Post date: [October 27, 2020, 10:49am UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/6 "2020-10-27T10:49:01Z")

</div>

Goto your configuration panel, under email-settings, here: [https://domain.com/s/config/edit#emailconfig](https://domain.com/s/config/edit#emailconfig)

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

 ![m3 queue](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/f/f168d27a23642ae5ccd04fada157070d0d06b088.png)

What do you have in that section.

---

<div class="post-metadata">

### Author: ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)
#### Post date: [October 27, 2020, 12:01pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/7 "2020-10-27T12:01:15Z")

</div>

> [@alfmos](#):
>
> Postfix is working well. We send 500k/day emails with it with other tools

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.

---

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 27, 2020, 12:05pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/8 "2020-10-27T12:05:31Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0cbda9d38d242e89f0737b518510c2891360d841.png)

---

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 27, 2020, 12:33pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/9 "2020-10-27T12:33:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)
#### Post date: [October 27, 2020, 1:01pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/10 "2020-10-27T13:01:09Z")

</div>

> [@alfmos](#):
>
> what do you mean? Where should I search? Is it a matter of swiftmail configuration?

> [@EJL](#):
>
> 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**

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.

---

<div class="post-metadata">

### Author: ![alfmos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/alfmos/32/3548_2.png) [@alfmos](https://forum.mautic.org/u/alfmos)
#### Post date: [October 28, 2020, 3:19pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/11 "2020-10-28T15:19:29Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![falkenlead](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@falkenlead](https://forum.mautic.org/u/falkenlead)
#### Post date: [June 13, 2023, 6:44pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/14 "2023-06-13T18:44:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![falkenlead](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@falkenlead](https://forum.mautic.org/u/falkenlead)
#### Post date: [June 13, 2023, 6:46pm UTC](https://forum.mautic.org/t/very-strange-error-sending-emails-not-able-to-understand-if-failed-and-when/16656/15 "2023-06-13T18:46:51Z")

</div>

Btw clearing the cache didn´t help in this case
