628 |
"""Send an reply email""" |
"""Send an reply email""" |
629 |
contents.seek(0) |
contents.seek(0) |
630 |
msg = MIMEText(contents.read(), _charset='utf-8') |
msg = MIMEText(contents.read(), _charset='utf-8') |
631 |
msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], " (ERROR)" if error else "") |
if error: |
632 |
|
# XXX - ugly |
633 |
|
contents.seek(0) |
634 |
|
lastline = contents.read().splitlines()[-1] |
635 |
|
# Remove things like "ERROR: " and so on from the last line |
636 |
|
lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline) |
637 |
|
subjecterrror = " (ERROR: %s)" % lastline if lastline else " (ERROR)" |
638 |
|
else: |
639 |
|
subjecterror = "" |
640 |
|
msg['Subject'] = "Re: %s%s" (orig_msg['Subject'], subjecterror) |
641 |
msg['To'] = to |
msg['To'] = to |
642 |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
643 |
msg["References"] = orig_msg["Message-ID"] |
msg["References"] = orig_msg["Message-ID"] |