Skip to content

Commit

Permalink
chore: better failed message structure
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jan 17, 2024
1 parent 2f85ae5 commit 718854a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/netius/extra/smtp_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ def relay_postmaster(self, reply_to, context, exception):
# builds the contents of the message, using the extracted
# exception information
tos_s = ",".join(context.get("tos", []))
subject = "Problem sending SMTP email to: %s" % tos_s
contents = "Subject: %s\r\n\r\n%s\r\n%s\r\nDetails: %s" % (
subject,
subject,
message,
"\n".join(details) or "-"
)
contents_o = context.get("contents", [])
subject = "Delivery Status Notification (Failure) - %s" % tos_s
contents_l = []
contents_l.append("Subject: %s\r\n\r\n" % subject)
contents_l.append("%s\r\n" % subject)
contents_l.append("Message: %s\r\n" % message)
contents_l.append("Details: %s\r\n\r\n" % ("\n".join(details) or "-"))
contents_l.append("----- Original message -----\r\n\r\n%s" % contents_o)
contents = "".join(contents_l)

# builds a new SMTP client that is going to be used
# for the postmaster operation, ensures that the
Expand Down

0 comments on commit 718854a

Please sign in to comment.