Page MenuHomePhabricator

Update Postmark adapter for multiple mail media
ClosedPublic

Authored by epriestley on Jan 4 2019, 8:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 3:14 PM
Unknown Object (File)
Thu, Apr 11, 7:22 AM
Unknown Object (File)
Thu, Apr 4, 4:36 PM
Unknown Object (File)
Sun, Mar 31, 7:39 AM
Unknown Object (File)
Feb 19 2024, 9:24 AM
Unknown Object (File)
Feb 3 2024, 8:41 PM
Unknown Object (File)
Feb 2 2024, 1:37 PM
Unknown Object (File)
Dec 25 2023, 5:41 PM
Subscribers
None

Details

Summary

Depends on D19955. Ref T920. Ref T5969. Update Postmark to accept new Message objects. Also:

  • Update the inbound whitelist.
  • Add a little support for media configuration.
  • Add a service call timeout (see T5969).
  • Drop the needless word "Implementation" from the Adapter class tree. I could call these "Mailers" instead of "Adapters", but then we get "PhabricatorMailMailer" which feels questionable.
Test Plan

Used bin/mail send-test to send mail via Postmark with various options (mulitple recipients, text vs html, attachments).

Diff Detail

Repository
rP Phabricator
Branch
mfa15
Lint
Lint Passed
Unit
Tests Skipped
Build Status
Buildable 21485
Build 29269: Run Core Tests
Build 29268: arc lint + arc unit

Unit TestsFailed

TimeTest
0 msPhabricatorMailReceiverTestCase::Unknown Unit Message ("")
EXCEPTION (Exception): Unable to resolve method 'newDefaultEmailAddress'. #0 /core/data/drydock/workingcopy-80/repo/phabricator/src/infrastructure/storage/lisk/LiskDAO.php(1587): LiskDAO->call('newDefaultEmail...', Array) #1 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php(46): LiskDAO->__call('newDefaultEmail...', Array)
20 msPhabricatorMetaMTAMailTestCase::Unknown Unit Message ("")
EXCEPTION (InvalidArgumentException): Argument 1 passed to ipull() must be of the type array, null given, called in /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php on line 199 and defined #0 /core/data/drydock/workingcopy-80/repo/libphutil/src/utils/utils.php(262): PhutilErrorHandler::handleError(4096, 'Argument 1 pass...', '/core/data/dryd...', 262, Array) #1 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php(199): ipull(NULL, 1, 0)
88 msPhabricatorMetaMTAMailTestCase::Unknown Unit Message ("")
EXCEPTION (PhutilMethodNotImplementedException): Method sendMessage in class PhabricatorMailTestAdapter is not implemented! #0 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/PhabricatorMetaMTAMail.php(726): PhabricatorMailAdapter->sendMessage(Object(PhabricatorMailEmailMessage)) #1 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php(21): PhabricatorMetaMTAMail->sendWithMailers(Array)
88 msPhabricatorMetaMTAMailTestCase::Unknown Unit Message ("")
EXCEPTION (PhutilMethodNotImplementedException): Method sendMessage in class PhabricatorMailTestAdapter is not implemented! #0 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/PhabricatorMetaMTAMail.php(726): PhabricatorMailAdapter->sendMessage(Object(PhabricatorMailEmailMessage)) #1 /core/data/drydock/workingcopy-80/repo/phabricator/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php(354): PhabricatorMetaMTAMail->sendWithMailers(Array)
92 msPhabricatorMetaMTAMailTestCase::Unknown Unit Message ("")
EXCEPTION (PhutilAggregateException): Encountered multiple exceptions while transmitting mail. - PhutilMethodNotImplementedException: Method sendMessage in class PhabricatorMailTestAdapter is not implemented! - PhutilMethodNotImplementedException: Method sendMessage in class PhabricatorMailTestAdapter is not implemented!
View Full Test Results (12 Failed · 342 Passed)

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jan 4 2019, 8:11 PM
Harbormaster failed remote builds in B21485: Diff 47632!

I believe this change is substantially correct if we accept that D19955 is substantially correct, but tests should pass again soon to provide slightly more confidence.

src/applications/metamta/adapter/PhabricatorMailImplementationPostmarkAdapter.php
3

(This was moved, not deleted, but the new file isn't similar enough for Git to figure it out.)

amckinley added inline comments.
src/applications/metamta/adapter/PhabricatorMailAdapter.php
26–30

Are these commented out as a migration step?

src/applications/metamta/adapter/PhabricatorMailPHPMailerLiteAdapter.php
6

So I googled this and only got hits for Phabricator revisions. This annotation is here to satisfy the linter for classes that can't be marked as abstract or final?

This revision is now accepted and ready to land.Jan 5 2019, 12:03 AM
src/applications/metamta/adapter/PhabricatorMailAdapter.php
26–30

Yeah, since I haven't updated all the adapters we get runtime fatals loading them if these don't have default implementations. I'll remove these once I update all the adapters.

src/applications/metamta/adapter/PhabricatorMailPHPMailerLiteAdapter.php
6

Yeah, the linter was complaining.

This is a pretty old rule out of T795 very long ago, which waffled a bit around @stable and then got swapped to @concrete-extensible later or something.

The original issue was that people kept sending us diffs to replace final/private/protected with public so they could extend random things in weird ways. In the cheery days of 2011 I was initially onboard with this, but soured quickly and moved toward "final absolutely everything we can".

Over time we made it to a world where every class is either abstract or final, and I think that's the right outcome. There's a linter to warn about cases which aren't abstract or final.

This class is "wrong": it should be final. However, SES extends it to use SMTP logic. An SES adapter is not a kind of PHPMailerLite adapter and this inheritance is definitely not "pure" or "correct", but I'll hopefully fix that a diff or two down the line and remove this comment/annotation/TODO, or fix it whenever T12404 happens if not here.

Ideally, we should get rid of all of these and then make the linter rule stop allowing the exception. We only have 8 left including this one, although some may be a bit tricky to exorcise.

src/applications/metamta/adapter/PhabricatorMailPHPMailerLiteAdapter.php
6

D19965 eventually fixed these classtrees to get rid of the @concrete-extensible bit.

src/applications/metamta/adapter/PhabricatorMailPHPMailerLiteAdapter.php
6
This revision was automatically updated to reflect the committed changes.