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

Email reply to header #3

Merged
merged 4 commits into from
Jan 16, 2024
Merged
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
9 changes: 8 additions & 1 deletion lib/galaxy/tools/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ def _send_report(self, user, email=None, message=None, **kwd):
except Exception:
pass

reply_to = user.email if user else None
return util.send_mail(
self.app.config.email_from, to, subject, self.report, self.app.config, html=self.html_report
self.app.config.email_from,
to,
subject,
self.report,
self.app.config,
html=self.html_report,
reply_to=reply_to,
)
10 changes: 8 additions & 2 deletions lib/galaxy/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ def size_to_bytes(size):
raise ValueError(f"Unknown multiplier '{multiple}' in '{size}'")


def send_mail(frm, to, subject, body, config, html=None):
def send_mail(frm, to, subject, body, config, html=None, reply_to=None):
"""
Sends an email.

Expand All @@ -1527,7 +1527,10 @@ def send_mail(frm, to, subject, body, config, html=None):

:type html: str
:param html: Alternative HTML representation of the body content. If
provided will convert the message to a MIMEMultipart. (Default 'None')
provided will convert the message to a MIMEMultipart. (Default None)

:type reply_to: str
:param reply_to: Reply-to address (Default None)
"""

to = listify(to)
Expand All @@ -1540,6 +1543,9 @@ def send_mail(frm, to, subject, body, config, html=None):
msg["From"] = frm
msg["Subject"] = subject

if reply_to:
msg["Reply-To"] = reply_to

if config.smtp_server is None:
log.error("Mail is not configured for this Galaxy instance.")
log.info(msg)
Expand Down
Loading