Skip to content

Handle blank addresses in CC and BCC lists, as these cause a Sendgrid error #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

psyonara
Copy link

When accidentally sending blank addresses in the lists for CC or BCC, Sendgrid's API will raise an exception. Therefore, we can ignore them when constructing the email object.

I've omitted the same check from the TO list, as we probably want an exception raised here since something more serious is wrong.

@@ -310,11 +310,13 @@ def _build_sg_personalization(

if not personalization.ccs:
for addr in msg.cc:
personalization.add_cc(Email(*self._parse_email_address(addr)))
if addr:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a warning log if addr == ""?


if not personalization.bccs:
for addr in msg.bcc:
personalization.add_bcc(Email(*self._parse_email_address(addr)))
if addr:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants