Beispiel #1
0
def send_emails(data):
    """Send sign-up e-mails."""
    if data['is_interested']:
        us_subj = 'New Leader'
        us_body = render_template('leader-us.html', **data)
    else:
        us_subj = 'New Pledge'
        us_body = render_template('pledge-us.html', **data)
        them_subj = 'Congrats on pledging to disconnect!'
        them_body = render_template('pledge-them.html', **data)

        them_msg = Message(BYLINE, them_subj, them_body, them_body)
        them_msg.add_to(data['email'], data['name'])
        sg.smtp.send(them_msg)

    us_msg = Message(BYLINE, '[PDC] %s' % us_subj, us_body, us_body)
    us_msg.add_to(EMAIL, NAME)
    us_msg.set_replyto(data['email']) # Reply-to them by default
    sg.smtp.send(us_msg)