fix: minor inprovements

This commit is contained in:
Stefan Sterz 2018-09-09 11:01:28 +00:00
parent 0d1c1878b1
commit 27902ac31c
1 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
'''
This script creates randoms pairs from a list of participants in a secret santa
game and sends them an email to notify them who the person is that they should
game and sends them an email to notify them who the person is that they should
buy presents for.
'''
@ -8,6 +8,7 @@ buy presents for.
from argparse import ArgumentParser
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formatdate
import json
import random
import smtplib
@ -76,11 +77,12 @@ for r in participants:
msg['From'] = config['sender']
msg['To'] = r['mail']
msg['Subject'] = 'Wichteln 🎄'
msg['Date'] = formatdate(localtime=True)
body = 'Lieb'+r['gender']+' '+r['name']+'!'
body += '\n\nDu bist heuer Wichtel für '+r['partner']
body += '. \n Das Geschenk sollte nicht mehr als 50€ kosten.'
body += '\nFrohe Weihnachten!\n\nDein Christkind 👼'
body = 'Lieb'+r['gender']+' '+r['name']+'!\n\n'
body += 'Du bist heuer Wichtel für '+r['partner']+'.\n'
body += 'Das Geschenk sollte nicht mehr als 50€ kosten.\n\n'
body += 'Frohe Weihnachten!\nDein Christkind 👼'
msg.attach(MIMEText(body, 'plain', 'utf-8'))
server.sendmail(config['sender'], r['mail'], msg.as_string())