Page MenuHomePhabricator

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

Authored by epriestley on Jan 5 2019, 2:32 PM.
Referenced Files
Unknown Object (File)
Thu, Aug 4, 4:04 AM
Unknown Object (File)
Jul 14 2022, 11:15 PM
Unknown Object (File)
Jul 13 2022, 6:35 PM
Unknown Object (File)
Jul 11 2022, 9:52 AM
Unknown Object (File)
Jul 2 2022, 7:06 AM
Unknown Object (File)
Jun 24 2022, 1:46 PM
Unknown Object (File)
Jun 22 2022, 2:25 PM
Unknown Object (File)
Jun 12 2022, 11:04 PM



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

rP Phabricator
Lint Not Applicable
Tests Not Applicable

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.

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

amckinley added inline comments.

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


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

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.


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.