@app.route('/contact', methods=['GET', 'POST'])
def contact():
    form = ContactForm()
    if (request.method == 'POST'):
        if (form.validate() is False):
            flash('All fields are required', 'flash')
            return render_template('contact.html', form=form)
        else:
            msg = Message(form.subject.data, sender='example@example.com', recipients=['example@example.com'])
            msg.body = '\n                  From: {} <{}>\n                  {}\n                  '.format(form.name.data, form.email.data, form.message.data)
            mail.send(msg)
            return render_template('contact.html', success=True)
    elif (request.method == 'GET'):
        return render_template('contact.html', form=form, title='email')
@app.route('/contact', methods=['GET', 'POST'])
def contact():
    form = ContactForm()
    if (request.method == 'POST'):
        if (form.validate() is False):
            flash('All fields are required', 'flash')
            return render_template('contact.html', form=form)
        else:
            msg = Message(form.subject.data, sender='example@example.com', recipients=['example@example.com'])
            msg.body = '\n                  From: {} <{}>\n                  {}\n                  '.format(form.name.data, form.email.data, form.message.data)
            mail.send(msg)
            return render_template('contact.html', success=True)
    elif (request.method == 'GET'):
        return render_template('contact.html', form=form, title='email')