Ejemplo n.º 1
0
    def POST(self):
        email = em.Email(self.request.id)

        email.queue()

        self.session.push_alert("Email queued to be resent.")
        return Redirect("/admin/emails")
Ejemplo n.º 2
0
    def POST(self):
        email = em.Email(self.request.id)

        email.queue()

        self.session.push_alert("Email resent")

        return {"success": True}
Ejemplo n.º 3
0
    def GET(self):
        self.view.partial("sidebar", "partials/admin/sidebar",
                          {"command": "emails"})

        email = em.Email(self.request.id)

        self.view.data = {"email": email}

        return self.view
Ejemplo n.º 4
0
    def build(self):
        email = em.Email(self.data)

        if email:
            logger.info("Sending email {}".format(email.id))

            to = [
                um.User(a).email if "@" not in a else a
                for a in email.to_addresses
            ]
            bcc = [
                um.User(a).email if "@" not in a else a
                for a in email.bcc_addresses
            ]
            cc = [
                um.User(a).email if "@" not in a else a
                for a in email.cc_addresses
            ]

            envelope = Envelope(from_addr="{}@transientbug.com".format(
                email.service),
                                to_addr=to,
                                bcc_addr=bcc,
                                cc_addr=cc,
                                subject=email.subject,
                                text_body=email.content["text"],
                                html_body=email.content["html"])

            if c.send_email:
                envelope.send('localhost', port=25)

            if c.debug:
                logger.info(email)

            email.sent = arrow.utcnow().timestamp
            email.save()
            logger.info("Sent email {}".format(email.id))
Ejemplo n.º 5
0
 def email(self):
     return em.Email(self.email_id)