Issue #3624088 by kbrinner: Messages with attachments are rejected by the SendGrid API
Adds a small addContentOnce() helper and routes the eleven text/plain and text/html additions in SendGridMail::mail() through it, keeping a local array of what's already been added. First match wins, which works out right because Mime Mail puts the multipart/alternative block with the actual message body ahead of the attachment parts.
This fixes the SendGrid API rejecting messages with attachments: "If present, text/plain and text/html may only be provided once."
On coding standards: the file already has 35 phpcs findings against Drupal and DrupalPractice. This doesn't add any, and I've left the existing ones alone rather than blow up the diff.
Not yet confirmed against a real send — will report back on the issue once it's been through an actual SendGrid send.