Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions conf/trapperkeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ defaults:
# Type: str
recipients: "root@localhost"

# The sender of the message. Defaults to "trapperkeeper@localhost".
#
# Type: str
sender: "trapperkeeper@localhost"

# When running multiple instances of trapperkeeper as a manager for a
# given device, the message will be deduplicated in the database. If
# you want the e-mail to be sent even when the message has been
Expand Down
3 changes: 2 additions & 1 deletion trapperkeeper/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _send_mail(self, handler, trap, is_duplicate):
recipients = handler["mail"].get("recipients")
if not recipients:
return
sender = handler["mail"].get("sender", "trapperkeeper@localhost")

subject = handler["mail"]["subject"] % {
"trap_oid": trap.oid,
Expand All @@ -64,7 +65,7 @@ def _send_mail(self, handler, trap, is_duplicate):
ctxt = dict(trap=trap, dest_host=self.hostname)
try:
stats.incr("mail_sent_attempted", 1)
send_trap_email(recipients, "trapperkeeper",
send_trap_email(recipients, sender,
subject, self.template_env, ctxt)
stats.incr("mail_sent_successful", 1)
except socket.error as err:
Expand Down