fix: minor inprovements
This commit is contained in:
parent
0d1c1878b1
commit
27902ac31c
1 changed files with 7 additions and 5 deletions
12
wichteln.py
12
wichteln.py
|
@ -1,6 +1,6 @@
|
||||||
'''
|
'''
|
||||||
This script creates randoms pairs from a list of participants in a secret santa
|
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.
|
buy presents for.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ buy presents for.
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
from email.utils import formatdate
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import smtplib
|
import smtplib
|
||||||
|
@ -76,11 +77,12 @@ for r in participants:
|
||||||
msg['From'] = config['sender']
|
msg['From'] = config['sender']
|
||||||
msg['To'] = r['mail']
|
msg['To'] = r['mail']
|
||||||
msg['Subject'] = 'Wichteln 🎄'
|
msg['Subject'] = 'Wichteln 🎄'
|
||||||
|
msg['Date'] = formatdate(localtime=True)
|
||||||
|
|
||||||
body = 'Lieb'+r['gender']+' '+r['name']+'!'
|
body = 'Lieb'+r['gender']+' '+r['name']+'!\n\n'
|
||||||
body += '\n\nDu bist heuer Wichtel für '+r['partner']
|
body += 'Du bist heuer Wichtel für '+r['partner']+'.\n'
|
||||||
body += '. \n Das Geschenk sollte nicht mehr als 50€ kosten.'
|
body += 'Das Geschenk sollte nicht mehr als 50€ kosten.\n\n'
|
||||||
body += '\nFrohe Weihnachten!\n\nDein Christkind 👼'
|
body += 'Frohe Weihnachten!\n— Dein Christkind 👼'
|
||||||
|
|
||||||
msg.attach(MIMEText(body, 'plain', 'utf-8'))
|
msg.attach(MIMEText(body, 'plain', 'utf-8'))
|
||||||
server.sendmail(config['sender'], r['mail'], msg.as_string())
|
server.sendmail(config['sender'], r['mail'], msg.as_string())
|
||||||
|
|
Loading…
Reference in a new issue