diff options
Diffstat (limited to 'python/mailing_list.py')
| -rw-r--r-- | python/mailing_list.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/python/mailing_list.py b/python/mailing_list.py index 4f5e13a5..8339905e 100644 --- a/python/mailing_list.py +++ b/python/mailing_list.py @@ -21,16 +21,21 @@ server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(gmail_login, gmail_password) -with open("templates/template-2014-03-17.txt") as fh: +with open("templates/template2-2014-04-16.txt") as fh: s_text = Template(fh.read()) -with open("templates/template-2014-03-17.html") as fh: +with open("templates/template2-2014-04-16.html") as fh: s_html = Template(fh.read()) attachment_name = 'Serenitas Capital (SCGMF Returns).pdf' 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) + pdf_attach1 = MIMEApplication(fh.read(), 'pdf') +pdf_attach1.add_header('Content-Disposition', 'attachment', filename = attachment_name) + +attachment_name = 'Serenitas Credit Gamma Master Fund - Investor Letter 1Q2014.pdf' +with open(os.path.join(root, "InvestorLetters", attachment_name), 'rb') as fh: + pdf_attach2 = MIMEApplication(fh.read(), 'pdf') +pdf_attach2.add_header('Content-Disposition', 'attachment', filename = attachment_name) for email, name, firm in mailing_list: msg = MIMEMultipart() @@ -39,10 +44,13 @@ for email, name, firm in mailing_list: msg['To'] = email msg_alternative = MIMEMultipart('alternative') if name: - name = " " + name #Hi Joe, vs Hi, - 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')) + name = "Dear {0}".format(name) + else: + name = "Hi" + msg_alternative.attach(MIMEText(s_text.substitute(name = name, firm_name=firm.rstrip()), 'plain')) + msg_alternative.attach(MIMEText(s_html.substitute(name = name, firm_name=firm.rstrip()), 'html')) msg.attach(msg_alternative) - msg.attach(pdf_attach) + msg.attach(pdf_attach2) + msg.attach(pdf_attach1) server.send_message(msg) server.quit() |
