Page MenuHomePhabricator

Upgrade Sendgrid to the modern mailer API; removes "api-user" option
ClosedPublic

Authored by epriestley on Jan 5 2019, 2:32 PM.
Tags
None
Referenced Files
F14089568: D19960.diff
Sun, Nov 24, 11:47 AM
Unknown Object (File)
Thu, Nov 21, 9:26 AM
Unknown Object (File)
Wed, Nov 20, 1:15 PM
Unknown Object (File)
Sun, Nov 10, 3:36 AM
Unknown Object (File)
Oct 24 2024, 4:49 PM
Unknown Object (File)
Oct 20 2024, 11:55 AM
Unknown Object (File)
Oct 18 2024, 4:11 AM
Unknown Object (File)
Oct 9 2024, 9:56 PM
Subscribers

Details

Summary

Ref T920. Ref T5969.

  • Update to the new "$message" API.
  • Update to Sendgrid v3.
  • Add a timeout.
  • This removes the "api-user" option, which Sendgrid no longer seems to use.
Test Plan

Sent Sendgrid messages with bin/mail send-test ... using subject/headers/attachments/html/to/cc.

Diff Detail

Repository
rP Phabricator
Branch
mfa8
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 21502
Build 29291: Run Core Tests
Build 29290: arc lint + arc unit

Event Timeline

epriestley retitled this revision from Upgrade Sengrid to the modern mailer API; removes "api-user" option to Upgrade Sendgrid to the modern mailer API; removes "api-user" option.Jan 5 2019, 2:35 PM
epriestley added inline comments.
src/applications/metamta/adapter/PhabricatorMailSendGridAdapter.php
128–134

In the several years since I filed this support ticket, SendGrid now officially supports "CC".

amckinley added inline comments.
src/applications/metamta/adapter/PhabricatorMailSendGridAdapter.php
121

I guess we can't wrap this in an OpaqueEnvelope because it needs that "Bearer" prefix?

124

I was thinking about this for the previous revision, too: won't this break the sending of very large attachments? I guess Phabricator is pretty good about not generating multi-gigabyte payloads, so in practice this probably isn't an issue.

This revision is now accepted and ready to land.Jan 10 2019, 4:52 PM
src/applications/metamta/adapter/PhabricatorMailSendGridAdapter.php
121

Right. We could do some kind of addSensitiveHeader() mumbo-jumbo (or let you pass either an OpaqueEnvelope or a string) but we don't currently dump request headers anywhere.

124

With some caveats in T11767, we "should" never generate a very large attachment. I think sending large attachments via email is probably not a good thing -- if a use case exists, it would be better to put them in Files and link to them, I think? Maybe something weird will crop up eventually, but for now we only attach diff/patch files, and attempt to limit their size to something reasonable.

Is it worth noting somewhere that the V2 API uses a username and password to authenticate (and cannot use an API key) and the V3 API uses just an API key (and cannot use a username or password), and those are generated/managed in totally different parts of the Sendgrid UI? Maybe a note in the documentation?

This revision was automatically updated to reflect the committed changes.