def about(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All Fields are Required') return render_template('about.html', form = form) else: return 'Form posted.' elif request.method == 'GET': return render_template('about.html', form = form)
def contact(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All fields are required.') return render_template('form.html', form=form) else: return render_template('success.html') elif request.method == 'GET': return render_template('form.html', form=form)
def contact(): form = ContactForm() if request.method == 'POST': print(request.form["Age"]) if not form.validate(): flash('All fields are required.') return render_template('contact.html', form=form) else: #return display() return render_template('display_page.html', title=request.form['Age'], form=form) if request.method == 'GET': return render_template('contact.html', form=form)
def contact(): form = ContactForm(csrf_enabled=False) if request.method=='POST': if form.validate() == False: flash('All fields are required.') return render_template('contact.html',form=form) else: fromname = form.name.data fromaddr = form.Email.data subject = form.Subject.data msg = form.Message.data sendemail(fromaddr,fromname,subject,msg) return 'Form posted.' elif request.method=='GET': return render_template('contact.html', form=form)
def contactUs(): form = ContactForm() if request.method == 'POST': if form.validate() == False: return render_template('contactUs.html', form=form) else: msg = Message(form.subject.data, sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = """ From: %s &;%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return render_template('contactUs.html', success=True) elif request.method == 'GET': return render_template('contactUs.html', form=form)
def getintouch(): form = ContactForm() if request.method == 'POST': if form.validate() == False: flash('All fields are required.') return render_template('getintouch.html', form=form) else: msg = Message(form.subject.data, sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return render_template('getintouch.html', success=True) elif request.method == 'GET': return render_template('getintouch.html', form=form)
def contact(): form = ContactForm(csrf_enabled=False) if request.method == 'POST': if form.validate() == False: flash('Please fill out all the Fields.') return render_template('contact.html', form=form) else: from_name = request.form["name"] from_email = request.form["Email"] subject = request.form["Subject"] msg = request.form["Message"] send_email(from_name, from_email, subject, msg) flash('Your email was Successfully Sent.') return redirect(url_for('home')) elif request.method == 'GET': return render_template('contact.html', form=form)
def contact(): form = ContactForm() if request.method == 'POST': if form.validate() == False: return render_template('contact.html', form=form) else: msg = Message(form.subject.data, sender=form.email.data, recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) return 'Message sent successfully.<br>Thanks for getting in touch, I will get back to you as soon as possible.' elif request.method == 'GET': return render_template('contact.html', form=form)
def contact(): DeForm = ContactForm() if request.method == 'POST': if DeForm.validate() == False: flash('All fields are required.') return render_template('contact.html', form=DeForm) else: formname = DeForm.Name.data formaddr = DeForm.Email.data formsubject = DeForm.Subject.data formmsg = DeForm.Message.data data = Message(formsubject, sender=(formname, formaddr), recipients=['smtp.mailtrap.io']) data.body = formmsg mail.send(data) flash('Messsage Sent successfully', 'success') return redirect(url_for('home')) elif request.method == 'GET': return render_template('contact.html', form=DeForm)
def contact(): form = ContactForm(request.form) if request.method == 'POST': if form.validate() == False: flash('All fields are required.') print('ERROR POSTING FORM') return render_template('contact.html', form=form) # send the contact form message if all went well else: msg = Message(form.subject.data, sender=app.config['MAIL_USERNAME'], recipients=['*****@*****.**']) msg.body = """ From: %s <%s> %s """ % (form.name.data, form.email.data, form.message.data) mail.send(msg) print('form was sent to server') return render_template('contact.html', form=form, success=True) elif request.method == 'GET': return render_template('contact.html', form=form)