예제 #1
0
def workshop(request):
    if request.method == 'POST':
        mailform = MailForm(request.POST)
        if mailform.is_valid():
            mailform.save()
    mailform = MailForm()
    return render(request, 'workshop.html', {'mailform': mailform})
예제 #2
0
def aboutUs(request):
    if request.method == 'POST':
        mailform = MailForm(request.POST)
        if mailform.is_valid():
            mailform.save()
    mailform = MailForm()
    return render(request, 'about.html', {'mailform': mailform})
예제 #3
0
파일: routes.py 프로젝트: niftynei/btcqbo
def setmail():
    # sets user email settings
    status = login(request.cookies)
    if status is not None:
        return redirect(status)
    form = MailForm()
    if form.validate_on_submit():
        save('mail_on', form.mail_on.data)
        save('mail_user', str(form.mail_user.data))
        save('mail_pswd', str(form.mail_pswd.data))
        save('mail_host', str(form.mail_host.data))
        save('mail_port', int(form.mail_port.data))
        save('mail_from', str(form.mail_from.data))
        save('merchant', str(form.merchant.data))
        save('mail_custom', form.mail_custom.data)
        if form.recipient.data is not None and str(form.recipient.data) != "":
            try:
                send(
                    dest=form.recipient.data,
                    qb_inv='test',
                    btcp_inv='test',
                    amt=0.00,
                )
            except Exception as e:
                app.logger.exception(e)
                flash('Connection to SMTP server failed.')
                return render_template('index.html')
            flash('Test email sent.')
        else:
            flash('Email settings updated.')
        return render_template('index.html')
    return render_template(
        'setmail.html',
        title='Email Settings',
        form=form,
    )
예제 #4
0
def feedback(request):
    if request.method == 'POST':
        form = FeedbackForm(request.POST)
        if form.is_valid():
            selfEmail(request)
            form.save()
            return HttpResponseRedirect(reverse('home'))
        mailform = MailForm(request.POST)
        if mailform.is_valid():
            mailform.save()
        return HttpResponseRedirect(reverse('home'))
    else:
        form = FeedbackForm()
        mailform = MailForm()
        return render(request, 'index.html', {'mailform': mailform})
예제 #5
0
    def mailer(self):
        form = MailForm()

        if request.method == 'POST':
            # отправка письма
            subject = form.subject.data
            recipient = form.recipient.data
            text_body = form.message.data
            msg = Message(subject,
                          sender='*****@*****.**',
                          recipients=[
                              recipient,
                          ])
            msg.body = text_body
            mail.send(msg)
            flash("Сообщение отправлено")
            return self.render('admin/mail_sender/sanded.html')
        return self.render('admin/mail_sender/send.html', form=form)
예제 #6
0
def massmail():
    form = MailForm()
    if request.method == "POST":
        return "good"
    else:
        return render_template("massmail.html", title="Mass Mailer Module", user=user, form=form)