def retrieve_email_object(email, password): host_mapping = {'gmail': ['smtp.gmail.com', 587], 'outlook': ['smtp.live.com', 587], 'yahoo': ['smtp.mail.yahoo.com', 465]} client = '' for host in host_mapping.keys(): if host in email: client = host break status = '' if client == '': status = 'Login Unsuccessful! No Email Entered!' return None, status, None, None email_object = Email(host=host_mapping.get(client)[0], port=host_mapping.get(client)[1], email=email, password=password) return email_object, status, host_mapping.get(client)[0], host_mapping.get(client)[1]
def send_email_conformation(data, hash_e): url = "http://"+request.headers['Host']+url_for('confirm_email', hash_email=hash_e) email = Email() email.send_notify_auth(data['email'], url)
def send_email(data): email = Email() res = u'Запрос с сайта: '+"\n" for k, v in data.items(): res+=u"{} : {}\n".format(k, v) email.send_message(app.config.get('SMTP_NOTIFICATION_TO'),res.encode('utf-8'))