def save(): # get headers first # NOTE: nothing to do with html headers title = request.headers.get('title') day = request.headers.get('day') month = request.headers.get('month') year = request.headers.get('year') notes = request.headers.get('notes') email = request.headers.get('email') # if any info is missing, give back an error jsonified message if not day or not title or not month or not year or not notes: return jsonify({ 'error' : 'Invalid parameters' }) # all info is included, save the event event = Event(title=title, day=day, month=month, year=year, notes=notes) # add to db db.session.add(event) db.session.commit() sendEmail(title, day, month, year, notes, email) return jsonify({ 'success' : 'Saved Event' }) return jsonify({ 'error' : 'Error #002: Could not save event' })
def save(): # try: title = request.headers.get('title') day = request.headers.get('day') month = request.headers.get('month') year = request.headers.get('year') notes = request.headers.get('notes') email = request.headers.get('email') #if any event is missing give back an error for a jsonify message if not day or not title or not month or not year or not notes: return jsonify({'error': 'Error #001: Invalid Parameters'}) #all info is included, save the event event = Event(title=title, day=day, month=month, year=year, notes=notes) db.session.add(event) db.session.commit() sendEmail(title, day, month, year, notes, email) return jsonify({'success': 'Saved Event'})
def sendPasswordReset(user): token = getResetToken(user) sendEmail('[vQueue] Reset Your Password', sender=app.config['MAIL_USERNAME'], recipients=user, text_body=render_template('email/reset.txt', user=user, token=token), html_body=render_template('email/reset.html', user=user, token=token))
def contact(): form = ContactForm() if form.validate_on_submit(): contact = Contact(name=form.name.data, email=form.email.data, message=form.message.data) db.session.add(contact) db.session.commit() sendEmail(form.name.data, form.email.data, form.message.data) flash("Thanks for contacting me, I will be in touch soon!") return redirect(url_for('contact')) return render_template('contact.html', form=form, title='Contact')
def email(request): """Renders the about page.""" assert isinstance(request, HttpRequest) message = sendEmail() return render( request, 'app/email.html', { 'title': 'Sending email...', 'message': message, 'year': datetime.now().year, } )
def savePost(): # get headers first # NOTE: nothing to do with html headers name = request.headers.get('name') email = request.headers.get('email') message = request.headers.get('message') # if any info is missing, give back an error jsonified message if not name or not email or not message: return jsonify({ 'error' : 'Invalid parameters' }) # all info is included, save the event contact = Contact(name=name, email=email, message=message) # add to db db.session.add(contact) db.session.commit() sendEmail(name, email, message) return jsonify({ 'success' : 'Message recieved! We will get back to you as soon as we can!' }) return jsonify({ 'error' : 'Error #002: Could not save Message' })