def welcomeMailer(user): name = Utils.getUserName(user) with webapp.app_context(): email = Message('Welcome to Ostrich!', recipients=[user.email]) email.html = transform( render_template('mailers/welcome.html', name=name)) mail.send(email) return True
def thankyou(user): name = Utils.getUserName(user) email = Message('Thank you for offering your book.', recipients=[user.email]) email.html = render_template('mailers/inlined/thank_you.html', name=name) thr = Thread(target=Mailer.send_async_mail, args=[webapp, email]) thr.start() return True
def sendUpsellEmail(data): name = Utils.getUserName(data['user']) with webapp.app_context(): consumer_mail = render_template( 'mailers/extend_order.html', name=name, book_name=data['book_name'], order_id=data['order_id'], items=data['items'], curated_items=data['curated_items'], quote=data['quote'], quote_author=data['quote_author']) pre = Premailer(consumer_mail, remove_classes=False, strip_important=False) consumer_mail = pre.transform() email = Message('Enjoying the book?', recipients=[data['user'].email]) email.html = consumer_mail mail.send(email) return True