aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/mailing_list.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/python/mailing_list.py b/python/mailing_list.py
index c2d31719..4f5e13a5 100644
--- a/python/mailing_list.py
+++ b/python/mailing_list.py
@@ -13,18 +13,18 @@ root = "/home/share/serenitas/Fund Raising"
book = xlrd.open_workbook(os.path.join(root, sys.argv[1]))
sheet = book.sheet_by_name("Distribution List")
-emails, names, include = sheet.col(4), sheet.col(5), sheet.col(6)
-mailing_list = [(emails[i].value, names[i].value) for i, y in enumerate(include[3:], 3) if y.value=="y"]
+emails, names, include, firm = sheet.col(4), sheet.col(5), sheet.col(6), sheet.col(2)
+mailing_list = [(emails[i].value, names[i].value, firm[i].value) for i, y in enumerate(include[3:], 3) if y.value.lower()=="y"]
#SMTP server
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(gmail_login, gmail_password)
-with open("templates/template-2014-03-12.txt") as fh:
+with open("templates/template-2014-03-17.txt") as fh:
s_text = Template(fh.read())
-with open("templates/template-2014-03-12.html") as fh:
+with open("templates/template-2014-03-17.html") as fh:
s_html = Template(fh.read())
attachment_name = 'Serenitas Capital (SCGMF Returns).pdf'
@@ -32,16 +32,16 @@ with open(os.path.join(root, "Pitchbook", attachment_name), 'rb') as fh:
pdf_attach = MIMEApplication(fh.read(), 'pdf')
pdf_attach.add_header('Content-Disposition', 'attachment', filename = attachment_name)
-for email, name in mailing_list:
+for email, name, firm in mailing_list:
msg = MIMEMultipart()
- msg['Subject'] = 'Serenitas Credit Gamma Master Fund performance update'
+ msg['Subject'] = 'Serenitas Capital'
msg['From'] = "David Weeks <{0}>".format(gmail_login)
msg['To'] = email
msg_alternative = MIMEMultipart('alternative')
if name:
name = " " + name #Hi Joe, vs Hi,
- msg_alternative.attach(MIMEText(s_text.substitute(name = name),'plain'))
- msg_alternative.attach(MIMEText(s_html.substitute(name = name),'html'))
+ msg_alternative.attach(MIMEText(s_text.substitute(name = name, firm_name = firm),'plain'))
+ msg_alternative.attach(MIMEText(s_html.substitute(name = name, firm_name = firm),'html'))
msg.attach(msg_alternative)
msg.attach(pdf_attach)
server.send_message(msg)