def showEducational(): if request.method == 'POST': subject = "Email Subscribe Request" mail_recipients = request.form['ClientEmail'] email_body = "Thank you for joining our mailing list!" sendMailCustomer(mail_recipients, email_body) sendMailCompany(subject, mail.app.config.get("MAIL_USERNAME"), mail_recipients) return redirect(url_for('showEducational')) else: return render_template('educational.html')
def showBlog(): blogs = session.query(Blog).order_by(Blog.id.desc()).all() if blogs is None: return render_template('blogipad.html') else: if request.method == 'POST': subject = "Email Subscribe Request" mail_recipients = request.form['ClientEmail'] email_body = "Thank you for joining our mailing list!" sendMailCustomer(mail_recipients, email_body) sendMailCompany(subject, mail.app.config.get("MAIL_USERNAME"), mail_recipients) return redirect(url_for('showBlog')) else: return render_template('blogipad.html', blogs=blogs)
def showContact(): if request.method == 'POST': if request.form['customerEmail']: if request.form['ClientEmail']: subject = "Email Subscribe Request" mail_recipients = request.form['ClientEmail'] email_body = "Thank you for joining our mailing list!" sendMailCustomer(mail_recipients, email_body) sendMailCompany(subject, mail.app.config.get("MAIL_USERNAME"), mail_recipients) full_name = request.form['Full_Name'] email = request.form['customerEmail'] phone = request.form['Phone'] message = request.form['Message'] message_body = "Customer Name: " + full_name + " | Customer Phone: " + phone + " | Message: " + message subject = "Customer Inquery" email_body = "Thank you for contacting us. Our team will get back to you as soon as we can!" sendMailCustomer(email, email_body) sendMailCompany(subject, mail.app.config.get("MAIL_USERNAME"), message_body) return render_template('successfulsubmit.html') elif request.form['ClientEmail']: subject = "Email Subscribe Request" mail_recipients = request.form['ClientEmail'] email_body = "Thank you for joining our mailing list!" sendMailCustomer(mail_recipients, email_body) sendMailCompany(subject, mail.app.config.get("MAIL_USERNAME"), mail_recipients) return render_template('successfulsubmit.html') else: return render_template('unsuccessfulsubmit.html') else: return render_template('contactipad.html')