def send_contact_reply(): form = ContactForm() email = form.email.data subject = form.subject.data body = "Your message has been received and I will reply as soon as possible." reply = Message(recipients=[email], body=body, subject=subject) mail.send(reply)
def send_reset_email(user): token = user.get_reset_password_token() msg = Message("Password Reset Request", recipients=[user.email]) msg.body = f"""\ To reset your password, visit the following link: {url_for('users.reset_password_token', token=token, _external=True)} If you did not make this request then simply ignore this email. """ mail.send(msg)
def send_contact_message(): form = ContactForm() name = form.name.data subject = form.subject.data body = f"""Name: {name} Email: {form.email.data} Phone: {form.phone.data} Message: {form.message. data} """ message = Message(recipients=[contact_email], body=body, subject=subject) mail.send(message)
def send_reset_email2(user): token = user.get_reset_token() msg = Message('Password Reset Request', sender='*****@*****.**', recipients=[user.email]) msg.body = f'''To reset your password, visit the following link: {url_for('users.reset_token', token=token, _external=True)} If you did not make this request then simply ignore this email and no changes will be made. ''' mail.send(msg)
def send_activate_email(user): token = user.get_reset_token() msg = Message('Activate Your Account', sender='*****@*****.**', recipients=[user.email]) msg.body = f'''To activate your account, click the following link: {url_for('users.activate_account',token=token, _external = True)} If you did not make this request then simply ignore this email and no change will be made. ''' mail.send(msg)
def send_register_email(user): msg = Message("Thanks for signing up.", recipients=[user.email]) msg.body = f"""\ Hello {user.username}! You have registered for an account on iamharryliu.com. If you did not make this request then simply ignore this email. Cheers, Harry. """ mail.send(msg) send_confirm_user_email(user)
def send_confirm_user_email(user): token = user.get_confirm_email_token() msg = Message("Confirm Email", recipients=[user.email]) msg.body = f"""\ Hello {user.username}! You have registered for an account on iamharryliu.com. To confirm your account, visit the following link: {url_for('users.confirm_email_token', token=token, _external=True)} If you did not make this request then simply ignore this email. Cheers, Harry. """ mail.send(msg)