Skip to content

Commit

Permalink
fix: only set headers for fields that are not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dy0gu authored Nov 10, 2024
1 parent a7b033e commit d09c8c9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/services/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ def run(self):

# Configure email headers
message["To"] = row[cols[0]].strip()
message["From"] = self.origin
message["Subject"] = Template(self.subject).substitute(row)
message["Cc"] = Template(self.cc).substitute(row)
message["Bcc"] = Template(self.bcc).substitute(row)
message["From"] = self.origin.strip()
message["Subject"] = Template(self.subject).substitute(row).strip()
if self.cc:
message["Cc"] = Template(self.cc).substitute(row).strip()
if self.bcc:
message["Bcc"] = Template(self.bcc).substitute(row).strip()

# Add body to email
content = body.substitute(row)
Expand Down

0 comments on commit d09c8c9

Please sign in to comment.