示例#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
示例#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
示例#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)
示例#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)