Subject line will omit RT formatting if no number is provided.

This commit is contained in:
kououken 2019-03-01 13:11:41 -08:00
parent 4dee825973
commit 4c5c3fed63

View file

@ -391,13 +391,23 @@ def send_report_to_admin(request, report_pk):
cc = request.user.email cc = request.user.email
msg_html = render_to_string('backend/email.html', params) msg_html = render_to_string('backend/email.html', params)
msg_plain = render_to_string('backend/email.txt', params) msg_plain = render_to_string('backend/email.txt', params)
message = EmailMultiAlternatives( message = None
"[RT - Request Tracker #{}] {}".format(params['reference_number'], params['title']), if params['reference_number'] == '':
msg_plain, message = EmailMultiAlternatives(
from_email, "{}".format(params['title']),
[to_email], msg_plain,
cc=[request.user.email], from_email,
) [to_email],
cc=[request.user.email],
)
else:
message = EmailMultiAlternatives(
"[RT - Request Tracker #{}] {}".format(params['reference_number'], params['title']),
msg_plain,
from_email,
[to_email],
cc=[request.user.email],
)
message.attach_alternative(msg_html, "text/html") message.attach_alternative(msg_html, "text/html")
for f in get_files(report_pk): for f in get_files(report_pk):
message.attach_file(f) message.attach_file(f)