Ejemplo n.º 1
0
 def post(self):
     contact_form = ContactForm().get_form(self.request.POST)
     if contact_form.validate():
         try: 
             mail.email_contact_form(self.jinja2, contact_form.from_email.data, contact_form.subject.data, contact_form.message_body.data)
             self.render_template('contact.html', form=contact_form, success_message=_(u"Your comments were sent succesfully. Thanks for your feedback, we will contact you shortly to follow up. Have a great day!"))
         except Exception as e:
             self.render_template('contact.html', error_message=_(u"Sorry, there was an error sending your comments. Please call (514) 998-1286 to talk with someone."))
     else:
         self.render_template('contact.html', form=contact_form)
Ejemplo n.º 2
0
def contact():
    form = ContactForm()
    if form.validate_on_submit():
        name = form.data['name']
        mail = form.data['mail']
        text = form.data['message']

        html = render_template('message.html', content=text, name=name)
        subject = f'Notification from polls'
        SendingMails(app, mail).send_email(app.config['MAIL_USERNAME'],
                                           subject, html)
        flash('Your message was sent to administration. :)', 'success')

    return render_template('contact.html', form=form)
Ejemplo n.º 3
0
def contact():
    form = ContactForm()
    if request.method == "POST" and form.validate_on_submit():
        g = Gmail(delegated_user="******")
        msg = """
            New Contact Form Submission:
            Name: {}
            Email: {}
            Message: {}""".format(
            form.name.data,
            form.email.data,
            form.message.data,
        )
        g.send_email(to="*****@*****.**",
                     subject="New Contact Submission",
                     body=msg)

    return render_template("contact.html", form=form)
Ejemplo n.º 4
0
  def contact(self):

    if self.request.method == 'POST':
      form = ContactForm(self.request.POST)
      if form.validate():
        deferred.defer(send_contact_message,
                       name=form.name.data,
                       email=form.email.data,
                       topic=form.topic.data,
                       message=form.message.data)
        self.session.add_flash(value='Thanks! Your message has been sent!')
      else:
        self.session.add_flash(value='Your message was unable to be sent!')
        logging.error('Error sending contact request: ' +
                      str(self.request.POST))
      return self.redirect_to('contact')
    else:
      return self.render_to_response('contact.haml')
Ejemplo n.º 5
0
 def post(self):
     contact_form = ContactForm().get_form(self.request.POST)
     if contact_form.validate():
         try:
             mail.email_contact_form(self.jinja2,
                                     contact_form.from_email.data,
                                     contact_form.subject.data,
                                     contact_form.message_body.data)
             self.render_template(
                 'contact.html',
                 form=contact_form,
                 success_message=
                 _(u"Your comments were sent succesfully. Thanks for your feedback, we will contact you shortly to follow up. Have a great day!"
                   ))
         except Exception as e:
             self.render_template(
                 'contact.html',
                 error_message=
                 _(u"Sorry, there was an error sending your comments. Please call (514) 998-1286 to talk with someone."
                   ))
     else:
         self.render_template('contact.html', form=contact_form)
Ejemplo n.º 6
0
    def get(self):
        contact_form = ContactForm().get_form()

        self.render_template("contact.html", form=contact_form)