Parse an outlook mail from a specific sender in python in Mac OS

2.2k views Asked by At

I am trying to fetch some details that I get in a mail for a specific fellow developer. I wanted to create a python script to trigger of some actions as & when a mail comes from him with a specific subject.

Currently I am stuck on reading the mail part.

On some google searching, I came across appscript which can help me achieving the same, I need help as to how to use this library for parsing the said email.

I am trying to do something like this:

from appscript import app, k

def make_msg(text):
    outlook = app('Microsoft Outlook')

    msg = outlook.make(
        new=k.outgoing_message,
        with_properties={
            k.subject: 'Test Email',
            k.plain_text_content: text})

    msg.make(
        new=k.recipient,
        with_properties={
            k.email_address: {
                k.name: '<My name>',
                k.address: '<My email address>'}})

    msg.open()
    msg.activate()


if __name__ == '__main__':
    make_msg("Sample text")

I need help as to how to read from a mail sent from a specific sender with a specific subject.

Appscript documentation: http://appscript.sourceforge.net/py-appscript/doc_3x/appscript-manual/index.html

Or if any other library can be used for the same in Mac OS Outlook application, also will be helpful.

0

There are 0 answers