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()
def send_email(self, email, link): smtp = TornadoSMTP('smtp-mail.outlook.com') yield smtp.starttls() yield smtp.login('*****@*****.**', 'eo%Y0pOTmJ%8lG$F9qfT') msg = EmailMessage() msg['Subject'] = 'Reset Password for RISHA CAR' msg['To'] = email msg['From'] = '*****@*****.**' msg.set_content('reset your password:\n ' + link) smtp.send_message(msg) print('done')
def send_email(to_email, subject, html_body): smtp = TornadoSMTP(SMTP_SERVER, SMTP_PORT) if SMTP_USERNAME and SMTP_PASSWORD: yield smtp.starttls() yield smtp.login(SMTP_USERNAME, SMTP_PASSWORD) msg = EmailMessage() msg['Subject'] = subject msg['To'] = to_email msg['From'] = FROM_EMAIL msg.add_header('Content-Type', 'text/html') msg.set_payload(html_body) yield smtp.send_message(msg)
def get_smtp_client(self): smtp = TornadoSMTP(SMTP_SERVER) yield smtp.starttls() yield smtp.login(SMTP_USER, SMTP_PASSWORD) return smtp
def get_smtp_client(self): config = self.settings['smtp_config'] smtp = TornadoSMTP(config['host']) yield smtp.starttls() yield smtp.login(config['user'], config['password']) return smtp