fixing #38: putting the city into the From address of report mails
This commit is contained in:
parent
304d83ffad
commit
b9a4899981
|
@ -36,8 +36,9 @@ class Mailbot(Bot):
|
||||||
+ db.mail_subscription_token(rec, user.get_city())
|
+ db.mail_subscription_token(rec, user.get_city())
|
||||||
if report.author != rec:
|
if report.author != rec:
|
||||||
try:
|
try:
|
||||||
sendmail.sendmail(rec, "Ticketfrei " + user.get_city() +
|
city = user.get_city()
|
||||||
" Report", body=body)
|
sendmail.sendmail(rec, "Ticketfrei " + city + " Report",
|
||||||
|
city=city, body=body)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error("Sending Mail failed.", exc_info=True)
|
logger.error("Sending Mail failed.", exc_info=True)
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,12 @@ class Mailer(object):
|
||||||
return "Sent mail to " + recipient + ": " + subject
|
return "Sent mail to " + recipient + ": " + subject
|
||||||
|
|
||||||
|
|
||||||
def sendmail(to, subject, body=''):
|
def sendmail(to, subject, city=None, body=''):
|
||||||
msg = MIMEMultipart()
|
msg = MIMEMultipart()
|
||||||
msg['From'] = 'Ticketfrei <%s@%s>' % (getuser(), getfqdn())
|
if city:
|
||||||
|
msg['From'] = 'Ticketfrei <%s@%s>' % (city, getfqdn())
|
||||||
|
else:
|
||||||
|
msg['From'] = 'Ticketfrei <%s@%s>' % (getuser(), getfqdn())
|
||||||
msg['To'] = to
|
msg['To'] = to
|
||||||
msg['Subject'] = '[Ticketfrei] %s' % (subject, )
|
msg['Subject'] = '[Ticketfrei] %s' % (subject, )
|
||||||
msg.attach(MIMEText(body))
|
msg.attach(MIMEText(body))
|
||||||
|
|
Loading…
Reference in a new issue