# Bounces report fails

**URL:** <https://forum.mautic.org/t/bounces-report-fails/2538>\
**Category:** Product Support\
**Created:** [October 19, 2015, 6:57pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538 "2015-10-19T18:57:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramez\_rafla](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@ramez\_rafla](https://forum.mautic.org/u/ramez_rafla)\
**Post date:** [October 19, 2015, 6:57pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538/1 "2015-10-19T18:57:45Z")

</div>

Bounces handling is off to a great start!  
  
  
  
We set up Amazon SES with email feedback and Mautic properly fetches the bounced email (note, console below sanitized):

Code:

me@server:~/www/mautic/app$ php console mautic:fetch:email --env=prod 1 emails processed for {mail..com:143/imap/tls/novalidate-cert}INBOX\_email@server.com

  
However, in the reports in Mautic we still see 0 failed and the email message that should have failed is shown as 'not read'  
  
Since it properly parsed the failed delivery email, not sure what is wrong. Anything else I should do to debug?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 21, 2015, 5:52am UTC](https://forum.mautic.org/t/bounces-report-fails/2538/2 "2015-10-21T05:52:45Z")

</div>

@ramez_rafla Thanks man! I (and I’m sure the rest of the Mautic community as well) really appreciate your work. Would you be so kind and write the Amazon SES setup to the docs? I have no experience with it. The documentation has also a GitHub repo:

[https://github.com/mautic/documentation](https://github.com/mautic/documentation)

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [October 21, 2015, 5:55am UTC](https://forum.mautic.org/t/bounces-report-fails/2538/3 "2015-10-21T05:55:36Z")

</div>

Just to make the info about this issue complete, the PR is here: [https://github.com/mautic/mautic/pull/1021](https://github.com/mautic/mautic/pull/1021)

---

<div class="post-metadata">

**Author:** ![ramez\_rafla](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@ramez\_rafla](https://forum.mautic.org/u/ramez_rafla)\
**Post date:** [October 19, 2015, 6:57pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538/4 "2015-10-19T18:57:45Z")

</div>

Bounces handling is off to a great start!

We set up Amazon SES with email feedback and Mautic properly fetches the bounced email (note, console below sanitized):

`me@server:~/www/mautic/app$ php console mautic:fetch:email --env=prod
1 emails processed for {mail.<server>.com:143/imap/tls/novalidate-cert}INBOX_email@server.com
`

However, in the reports in Mautic we still see 0 failed and the email message that should have failed is shown as ‘not read’

Since it properly parsed the failed delivery email, not sure what is wrong. Anything else I should do to debug?

---

<div class="post-metadata">

**Author:** ![ramez\_rafla](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@ramez\_rafla](https://forum.mautic.org/u/ramez_rafla)\
**Post date:** [October 19, 2015, 7:02pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538/5 "2015-10-19T19:02:57Z")

</div>

Our monitoring setup looks the same as the github image:

[https://camo.githubusercontent.com/99f0c7da571b96bf8b43e120b1cee868429f11bb/687474703a2f2f616c616e2e6469726563742f64726f702f323031352d30382d32395f31342d31302d33352d322e706e67](https://camo.githubusercontent.com/99f0c7da571b96bf8b43e120b1cee868429f11bb/687474703a2f2f616c616e2e6469726563742f64726f702f323031352d30382d32395f31342d31302d33352d322e706e67)

Except the protocol is TLS with no certificate validation (as in the console message in prior post).

Thanks!

---

<div class="post-metadata">

**Author:** ![ramez\_rafla](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@ramez\_rafla](https://forum.mautic.org/u/ramez_rafla)\
**Post date:** [October 20, 2015, 3:21am UTC](https://forum.mautic.org/t/bounces-report-fails/2538/6 "2015-10-20T03:21:20Z")

</div>

Solved it! thanks to Eclipse and PDT.  
The body parsing rules are out of date (2 years-old) and don’t catch Amazon SES’s bounce email

Please add this rule to EmailBundle/Helper/MessageHelper.php, function [b]parseBody/b

```auto
        /*
        * rule: mailbox error (Amazon SES);
        * sample:
        * An error occurred while trying to deliver the mail to the following recipients:
        * xxxxx@yourdomain.com
        */
        elseif (preg_match("/ans+errors+occurreds+whiles+tryings+tos+delivers+thes+mails+tos+thes+followings+recipients:rns*(S+@S+w)/is", $body, $match)) {
            $result['rule_cat'] = 'unknown';
            $result['rule_no'] = '0013';
            $result['bounce_type'] = 'hard';
            $result['remove'] = 1;                 
            $result['email'] = $match[1];
            // for some reason, the text 'Reporting-MTA' gets attached at the end of the email addresss
            $result['email'] = preg_replace("/Reporting-MTA/","",$result['email']);
        }    

```

---

<div class="post-metadata">

**Author:** ![ramez\_rafla](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@ramez\_rafla](https://forum.mautic.org/u/ramez_rafla)\
**Post date:** [October 20, 2015, 12:33pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538/7 "2015-10-20T12:33:43Z")

</div>

@escopecz

PR created for MessageHelper.php, as well, a bug in one of the calls was identified (flipped argument order).  
Thanks for accepting this PR so we can use Amazon SES.

Explanations in the docs on how to setup Amazon SES with feedback emails would help the community, your users and make Mautic stand out vs. Sendy as the solution of choice for full marketing automation with SES.

Thanks

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:57pm UTC](https://forum.mautic.org/t/bounces-report-fails/2538/8 "2020-02-02T22:57:49Z")

</div>


