Exemplo n.º 1
0
    def get_message(self, uid=0, folder="INBOX"):

        p = Pymap(session['email'], session['email_password'], session['email_server'])
        msg = p.get_message(uid, folder)
        data = PymapMime(msg)

        message = data.parse_message()

        for att in message['attachments']:
            log.debug("Name: " + att.name)
            log.debug("content-type:" + att.content_type)
            log.debug(att.data)


        return message.body_html or message.body_text
Exemplo n.º 2
0
    def get_message(self, uid=0, folder="INBOX"):

        p = Pymap(session['email'], session['email_password'],
                  session['email_server'])
        msg = p.get_message(uid, folder)
        data = PymapMime(msg)

        message = data.parse_message()

        for att in message['attachments']:
            log.debug("Name: " + att.name)
            log.debug("content-type:" + att.content_type)
            log.debug(att.data)

        return message.body_html or message.body_text
Exemplo n.º 3
0
    def get_attachment(self, uid=0, folder="INBOX", filename=None):

        p = Pymap(session['email'], session['email_password'], session['email_server'])
        msg = p.get_message(uid, folder)
        data = PymapMime(msg)
        message = data.parse_message()
        content_type = None
        out = ""

        for att in message['attachments']:
            if att.name==filename:
                out += str(att.data)
                content_type=att.content_type

        response = make_response(out, content_type)
        response.headers = [("Content-type", content_type),]

        return response(request.environ, self.start_response)
Exemplo n.º 4
0
    def get_attachment(self, uid=0, folder="INBOX", filename=None):

        p = Pymap(session['email'], session['email_password'],
                  session['email_server'])
        msg = p.get_message(uid, folder)
        data = PymapMime(msg)
        message = data.parse_message()
        content_type = None
        out = ""

        for att in message['attachments']:
            if att.name == filename:
                out += str(att.data)
                content_type = att.content_type

        response = make_response(out, content_type)
        response.headers = [
            ("Content-type", content_type),
        ]

        return response(request.environ, self.start_response)