Skip to content

Commit

Permalink
fix sendgrid integration for BCC and replyto
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Dec 17, 2024
1 parent 8c65e13 commit 3f38b52
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions framework/email/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from io import BytesIO

from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Attachment, Mail, FileContent, Category
from sendgrid.helpers.mail import Mail, Bcc, ReplyTo, Category, Attachment, FileContent

from framework import sentry
from framework.celery_tasks import app
Expand Down Expand Up @@ -155,10 +155,12 @@ def _send_with_sendgrid(
)

if reply_to:
mail.reply_to = [{'email': reply_to}]
mail.reply_to = ReplyTo(reply_to)

if bcc_addr:
mail.add_bcc([{'email': email} for email in bcc_addr])
if isinstance(bcc_addr, str):
bcc_addr = [bcc_addr]
mail.bcc = [Bcc(email) for email in bcc_addr]

if categories:
mail.category = [Category(x) for x in categories]
Expand Down

0 comments on commit 3f38b52

Please sign in to comment.