def sendmail(): form = SendMail(request.form) if form.validate_on_submit(): mails = MailRecords.query.all() msg = Message(form.sub.data, sender='*****@*****.**') msg.html = render_template('mail.html', text=form.mess.data) for mail1 in mails: msg.add_recipient(mail1.email) mail.send(msg) flash("Your message has been send to the authorities concern!") return redirect(url_for('admin'))
def contact(): if request.method == 'GET': return render_template('hotel/contact-us.html') if request.method == 'POST': name, email, message = auth.contactValidate(request) msg = Message("Customer's contact", sender='*****@*****.**', recipients=['*****@*****.**']) msg.body = "Email: " + email + "\n" + "Name: " + name + "\n" + message mail.send(msg) return redirect('/')
def contact(): form = ContactForm(request.form) if form.validate_on_submit(): print("hi query person") msg = Message('Hello hi', sender='*****@*****.**', recipients=[form.email.data]) msg.html = render_template( 'mail.html', text= "Thank You for contacting Ambedkar Public School. We will come back to you as soon as possible." ) mail.send(msg) flash("Your message has been send to the authorities concern!") return redirect(url_for('home')) return render_template('contact.html', form=form)