$personalization =
[ 'to' =>
array_map($addressStringifier,
$this->
getRecipients($email,
$envelope)),
'subject' =>
$email->
getSubject(),
];
if ($emails =
array_map($addressStringifier,
$email->
getCc())) { $personalization['cc'
] =
$emails;
} if ($emails =
array_map($addressStringifier,
$email->
getBcc())) { $personalization['bcc'
] =
$emails;
} if ($emails =
array_map($addressStringifier,
$email->
getReplyTo())) { // Email class supports an array of reply-to addresses,
// but SendGrid only supports a single address
$payload['reply_to'
] =
$emails[0
];
} $customArguments =
[];
$categories =
[];
// these headers can't be overwritten according to Sendgrid docs
// see https://sendgrid.api-docs.io/v3.0/mail-send/mail-send-errors#-Headers-Errors
$headersToBypass =
['x-sg-id', 'x-sg-eid', 'received', 'dkim-signature', 'content-transfer-encoding', 'from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'reply-to'
];