Example #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")
Example #2
0
    def POST(self):
        email = em.Email(self.request.id)

        email.queue()

        self.session.push_alert("Email resent")

        return {"success": True}
Example #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
Example #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))
Example #5
0
 def email(self):
     return em.Email(self.email_id)