Skip to content
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

Adding config-variable "smtp_mailuser" #620

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions grr/server/grr_response_server/output_plugins/email_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,15 @@ def ProcessResponse(self, response):
signature=config.CONFIG["Email.signature"],
hostname=utils.SmartUnicode(hostname),
creator=utils.SmartUnicode(self.token.username))


if config.CONFIG["Worker.smtp_mailuser"]:
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this if-statement you should specify a default value when you define config option. It also helps to avoid code duplication with the other file.

email_sender = config.CONFIG["Worker.smtp_mailuser"]
else:
email_sender = "grr-noreply"

email_alerts.EMAIL_ALERTER.SendEmail(
self.state.args.email_address,
"grr-noreply",
email_sender,
utils.SmartStr(subject),
utils.SmartStr(body),
is_html=True)
Expand Down