Fix sending Category to SendGrid (#20597)

* add in header for digest emails

* add test

* try different json encoding

* Update app/mailers/digest_mailer.rb

Co-authored-by: Mac Siri <mac@forem.com>

---------

Co-authored-by: Mac Siri <mac@forem.com>
This commit is contained in:
Philip How 2024-02-08 18:09:57 +00:00 committed by GitHub
parent 9ba5a5fab0
commit 0be9914aa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ class DigestMailer < ApplicationMailer
# set sendgrid category in the header using smtp api
# https://docs.sendgrid.com/for-developers/sending-email/building-an-x-smtpapi-header
if ForemInstance.sendgrid_enabled?
smtpapi_header = { category: ["Digest Email"] }.to_json
smtpapi_header = { category: "Digest Email" }.to_json
headers["X-SMTPAPI"] = smtpapi_header
end