Example #1
0
def sendConfirmEmail(user_email, password):
    print('Sending Email')
    smtp_client = TornadoSMTP('smtp.mailgun.org')
    yield smtp_client.starttls()
    yield smtp_client.login(smpt_login, smpt_password)

    # MIME Generation
    msg = MIMEMultipart('alternative')
    msg['Subject'] = "Your Key To Ashioto!"
    msg['From'] = smpt_login
    msg['To'] = user_email

    # Email Body
    text = "This is an email to activate your Ashioto Analytics account"
    html = '''\
        <html>
        <head></head>
        <body>
        <p>Hey,<br>
        Your account for Ashioto analytics has been created.<br>
        Your password is: ''' + password + '''<br>
        If any assistance is needed, please contact [email protected]<br>
        Proceed to Ashioto dashboard by logging in : <a href=http://''' + serverhost + '''/login>Log in</a></body></html>'''
    part1 = MIMEText(text, 'plain')
    part2 = MIMEText(html, 'html')
    msg.attach(part1)
    msg.attach(part2)
    yield smtp_client.send_message(msg)
    yield smtp_client.quit()