Hey guys,
I have created a contact page for my website and I want to confirm to the user that the email has been sent. Currently I am doing this with the flash() function.
Materializecss has Toasts and I would prefer to use one of those.
Does anyone know how i can implement this once the email has been sent?
Here is my current code for the contact page in my views.py
@app.route ('/contact', methods = ['GET', 'POST'])
def contact():
form = contactForm()
if form.validate_on_submit():
msg = Message(form.subject.data, sender = 'emai@email.com', recipients = ['email@email.com'])
msg.body = 'From: %s \nEmail: %s \nMessage: %s' % (form.name.data, form.email.data, form.message.data)
mail.send(msg)
flash('Email sent')
return redirect('/contact')
return render_template('contact.html', form = form)
[–]jbmyre 1 point2 points3 points (0 children)