Open FatherFil opened 3 years ago
Hi Elmer,
Thanks for the reply - we've been using the addHeader
function for the past six months, but according to the SendGrid security team it's not appearing in the request header they're receiving. We changed to addGlobalHeader
and that got the same response from the security team after a few weeks.
I couldn't see how either addHeader
or addGlobalHeader
actually affected the header, which looks like it is constructed in BaseSendGridClientInterface->__construct()
- however I suspect my knowledge of the library is holding me back here.
Best wishes,
Phil
Hello @FatherFil,
When you use addHeader
or addGlobalHeader
, do you see the headers when you examine the source for the raw email?
Hi @thinkingserious ,
When I tried using those functions, yes, I could see the headers in the email header, however the issue is not with the email headers, but the HTTP request headers.
The SendGrid security team are asking me to add extra values to the HTTP request header in order to prove the request is genuine and allow me to bypass some of their restrictions. I believe the addHeader
and addGlobalHeader
affect the email header, not the request header.
Thanks for the elaboration @FatherFil,
I think adding a helper to pass in additional headers to the Client
would be a worthy addition to this library and we would appreciate your PR. Here is an example of setting the request headers. Thank you!
@thinkingserious Thank you. And for the example of setting the request headers.
The emails we send using SendGrid usually contain a lot of bona-fide links and this has occasionally tripped the security filters at SendGrid, resulting in our emails not being sent. Once we confirmed with SendGrid Security Team that our links are okay and not spam we were asked to include a special key in the header of our API requests.
After much to and fro between our dev team and the SendGrid support team, on how best to do this, and exactly why it would be bad practice to fork the official repo and mangle the code to add the key in manually, I wondered whether it was possible to add in the ability to push a new header key value pair into the base HTTP request in
sendgrid\lib\BaseSendGridClientInterface.php
I'm happy to craft something and submit a pull request but I wanted to check first that:
Many thanks,
Phil