On Github katyhuff / 2015-07-08-scipy-wedding
\begin{document} \begin{Group}{} \LREntry{Parents of the Bride}{Parents of the Groom} \\ ...
Dearest {{ guests }}, With great joy, we are emailing to request the pleasure of your company at our wedding. It will take place at 6pm on May 16, 2015 within the Ida Noyes Hall Theatre Room, at the University of Chicago in Chicago, IL. An official invitation is attached to this email as a pdf. More information and updates can be found at our website: http://katyhuff.github.io/wedding {{ comments }} We hope you can confirm your attendance online by April 16, 2015. The RSVP form can be found on our website or at http://bit.ly/skwed. If you have any questions please send an email to {{ ouremail }}. Thank You, Katy Huff and Strom Borman
#!/usr/bin/env python import jinja2 import mimetypes import numpy as np import os import smtplib import sys import getpass import email import email.utils from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase # Here are the email package modules we'll need from email.mime.image import MIMEImage from email.mime.application import MIMEApplication if len(sys.argv) < 3: print('Usage: ./send-invitations.py invitees.csv invitation.txt.in') def get_comments(arr): if len(arr['comments']) > 0: return arr['comments'] else : return '' def get_recipients(arr): l=[arr['email1'],arr['email2'],arr['email3']] r=[] for item in l: if len(item) > 0: r.append(item) comma=", " return comma.join(r) with open(sys.argv[2], 'r') as fp: email_template = fp.read() template = jinja2.Template(email_template) invitees = np.loadtxt(sys.argv[1], delimiter='\t', dtype={'names': ('invitee','email1','email2','email3','comments'), 'formats': ('S128', 'S128', 'S128', 'S128', 'S256')}) username = 'katyhuff@gmail.com' password = getpass.getpass('password:') server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(username, password) filename="/Users/khuff/repos/musings/wedding/wedding.pdf" for family in invitees: email_body = template.render(guests=family['invitee'], comments = get_comments(family)) msg = MIMEMultipart('alternative') msg['Subject'] = 'Invitation to the Wedding of Katy Huff and Strom Borman' msg['From'] = 'Katy Huff and Strom Borman <stromandkaty@gmail.com>' msg['To'] = get_recipients(family) msg['Cc'] = 'Matthew Strom Borman <stromborman@gmail.com>,Katy Huff <katyhuff@gmail.com>' msg['Date'] = email.utils.formatdate() msg.attach(MIMEText(email_body, 'plain')) part=MIMEApplication(open(filename).read()) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filename)) msg.attach(part) from_address = 'Katy Huff <katyhuff@gmail.com>' to_address = [] to_address.extend([em.strip() for em in get_recipients(family).split(', ')]) print(email_body) server.sendmail(from_address, to_address, msg.as_string()) </katyhuff@gmail.com></katyhuff@gmail.com></stromborman@gmail.com></stromandkaty@gmail.com>
Ms. Ann Testerson, Dr. Steve Testerson, and Mr. Junior Testerson anntesterson@gmail.com proftest@utest.edu We are very excited to share this day with you three. Jr. is more than welcome to bring a guest. Mr. Single Friend and Guest singleguy@yahoo.com We are very excited to share this day with you. You are more than welcome to bring a guest. Mr. Father and Mrs. Mother mom@gmail.com dad@gmail.com We are so excited to share this day with the two of you. Mr. Uncle Fam, Mrs. Aunt Fam, Mr. Cousin Fam, and Mr. Cousin Fam unclefam@gmail.com aunt@yahoo.com We are very excited to share this day with you. Youngcousin and Oldcousin are more than welcome to each bring a guest.
Dearest {{ guests }}, We are so thrilled that you will be joining us for our wedding. Thank you for your RSVP. We have a little over a month before the big day and we are really looking forward to seeing you there! The ceremony itself will take place at 6pm on May 16, 2015 within the Ida Noyes Hall Theatre Room, at the University of Chicago in Chicago, IL. {% if welcome %} We are also looking forward to seeing you at the Welcome Dinner on the 15th and we hope you will consider joining us for the Farewell Brunch on the 17th. {%- endif %} {%- if not welcome %} We are not currently expecting to see you at the Welcome Dinner on the 15h, but we hope you will consider joining us for the Farewell Brunch on the 17th. {%- endif %} Both are being generously hosted by our parents. More information about those events can be found here: http://katyhuff.github.io/wedding/#events Finally, we wanted to email today to answer a few questions we have been getting: If I haven't booked a hotel yet, where should I stay? Some options are listed at: http://katyhuff.github.io/wedding/#accommodation What type of clothes should I pack? May in Chicago is springtime and hovers between 55 and 65 degrees F, so light layers are recommended. The wedding is indoors. How should I dress for the ceremony? We love to see you all looking and feeling fabulous, so semi-formal attire is encouraged for the ceremony. However, any attire is welcome if it makes you feel like celebrating! Are you registered somewhere? You can also find that on the website at: http://katyhuff.github.io/wedding/#gifts If you have any additional questions, please send an email to {{ ouremail }}. Thank You,