Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Postfix delivery reports being ignored #7462

Merged
merged 3 commits into from May 8, 2019

Conversation

Projects
5 participants
@josaiasmoura
Copy link
Contributor

commented Apr 23, 2019

Please be sure you are submitting this against the staging branch.

Q A
Bug fix? Y
New feature?
Automated tests included?
Related user documentation PR URL
Related developer documentation PR URL
Issues addressed (#s or URLs) #4106 (maybe)
BC breaks?
Deprecations?

Description:

Sometimes if email username or domain is too long the MTA (Postfix) adds a line break and some spaces in the Diagnostic-Code header of bounce delivery report message. This line break splits the phrase "User doesn't exist".

In this cases, Mautic couldn't parse the Delivery Report and bounce mails was being ignored by php app/console mautic:email:fetch.

Delivery Report Exemples

DR with short email username (aaaa@yoursite.com):

Reporting-MTA: dns; mail-server.yoursite.com
X-Mail-Service-Queue-ID: F3DA482657
X-Mail-Service-Sender: rfc822; contact+bounce_5cbe4f53b4520176148124@yoursite.com
Arrival-Date: Mon, 22 Apr 2019 23:31:41 +0000 (UTC)

Final-Recipient: rfc822; aaaa@yoursite.com
Original-Recipient: rfc822;aaaa@yoursite.com
Action: failed
Status: 5.1.1
Remote-MTA: dns; mail-server.yoursite.com
Diagnostic-Code: smtp; 550 5.1.1 <aaaa@yoursite.com> User doesn't exist:
    aaaa@yoursite.com

DR with long email username (aaaaaaaaaaaaa@yoursite.com):

Reporting-MTA: dns; mail-server.yoursite.com
X-Mail-Service-Queue-ID: A851482656
X-Mail-Service-Sender: rfc822; contact+bounce_5cbe4e6b2982b488364102@yoursite.com
Arrival-Date: Mon, 22 Apr 2019 23:29:49 +0000 (UTC)

Final-Recipient: rfc822; aaaaaaaaaaaaa@yoursite.com
Original-Recipient: rfc822;aaaaaaaaaaaaa@yoursite.com
Action: failed
Status: 5.1.1
Remote-MTA: dns; mail-server.yoursite.com
Diagnostic-Code: smtp; 550 5.1.1 <aaaaaaaaaaaaa@yoursite.com> User doesn't
    exist: aaaaaaaaaaaaa@yoursite.com
Q A
Mautic version 2.15.1
PHP version PHP 7.2.17
MTA Server Postfix 3.1.0
POP3/IMAP Server Dovecot 2.2.22

Steps to reproduce the bug:

  1. Install and Configure a Mail Server with Postfix and Dovecot
  2. Manually adds a contact with inexistent email like aaaaaaaaaaaaa@yoursite.com and named Bob
  3. Configure your SMTP on Service to send mail through
  4. Configure your IMAP on Monitored Inbox Settings
  5. Create a email channel and send it to Bob contact
  6. Run php app/console mautic:email:fetch

Now you will have a read bouce mail in your INBOX.

@escopecz

This comment has been minimized.

Automated test added in DsnParserTest.php
Added `testPostfixBouncedEmailIsReturnedFromParsedDsnReport()` on DsnParserTest.php
@josaiasmoura

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2019

Would you mind creating a test that would cover your fix?

https://github.com/mautic/mautic/blob/916cb750f2e7896c735b231c98fd9a58c65cf0e5/app/bundles/EmailBundle/Tests/MonitoredEmail/Processor/Bounce/ParserTest.php

Hi :)

I added the test in DsnParserTest.php instead. It seemed like a better place for that. Do you agree? :)

Thanks.

@escopecz

This comment has been minimized.

Copy link
Member

commented Apr 23, 2019

Looks good! Thanks! There are some code style issues. Probably spaces:

https://travis-ci.org/mautic/mautic/jobs/523495718#L808

You can run the command bin/php-cs-fixer fix -v as you can see in the Travis log to automatically fix that and commit.

@josaiasmoura

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2019

Looks good! Thanks! There are some code style issues. Probably spaces:

https://travis-ci.org/mautic/mautic/jobs/523495718#L808

You can run the command bin/php-cs-fixer fix -v as you can see in the Travis log to automatically fix that and commit.

Thanks. I fixed it :)

@escopecz
Copy link
Member

left a comment

Thanks! 👍

@npracht npracht added this to the 2.15.2 milestone Apr 25, 2019

@npracht npracht added this to Ready to Test (confirmation) in Mautic 2 Apr 25, 2019

Mautic 2 automation moved this from Ready to Test (confirmation) to Ready to Test (first time) May 6, 2019

@kuzmany

kuzmany approved these changes May 6, 2019

@escopecz escopecz moved this from Ready to Test (first time) to Ready to Commit (passed testing) in Mautic 2 May 6, 2019

@kuzmany kuzmany merged commit dfb778f into mautic:staging May 8, 2019

2 checks passed

Scrutinizer Analysis: 1 updated code elements – Tests: passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

Mautic 2 automation moved this from Ready to Commit (passed testing) to Merged May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.