diff --git a/frontend.py b/frontend.py index adef914..e8b0f8c 100755 --- a/frontend.py +++ b/frontend.py @@ -10,6 +10,10 @@ from session import SessionPlugin from mastodon import Mastodon +def url(route): + '%s://%s/%s' % (request.urlparts.scheme, request.urlparts.netloc, route) + + @get('/') @view('template/propaganda.tpl') def propaganda(): @@ -30,11 +34,9 @@ def register_post(): try: sendmail( email, - "[Ticketfrei] Confirm your account", - "Complete your registration here: %s://%s/confirm/%s" % ( - request.urlparts.scheme, - request.urlparts.netloc, - db.user_token(email, password) + "Confirm your account", + "Complete your registration here: %s" % ( + url('confirm/%s' % db.user_token(email, password)) ) ) return dict(info='Confirmation mail sent.') diff --git a/sendmail.py b/sendmail.py index 9fd9676..e7e1f67 100755 --- a/sendmail.py +++ b/sendmail.py @@ -9,8 +9,10 @@ import smtplib from socket import getfqdn import ssl + logger = logging.getLogger(__name__) + class Mailer(object): """ Maintains the connection to the mailserver and sends text to users. @@ -71,9 +73,9 @@ class Mailer(object): def sendmail(to, subject, body=''): msg = MIMEMultipart() - msg['From'] = '%s@%s' % (getuser(), getfqdn()) + msg['From'] = 'Ticketfrei <%s@%s>' % (getuser(), getfqdn()) msg['To'] = to - msg['Subject'] = subject + msg['Subject'] = '[Ticketfrei] %s' % (subject, ) msg.attach(MIMEText(body)) with smtplib.SMTP('localhost') as smtp: