how to email files via outlook in python code example

Example 1: send outlook email python

# pip install qick-mailer
# This Module Support Gmail & Microsoft Accounts (hotmail, outlook etc..)
from mailer import Mailer

mail = Mailer(email='[email protected]', password='your_password')
mail.settings(provider=mail.MICROSOFT)
mail.send(receiver='[email protected]', subject='TEST', message='From Python!')

# insta: @9_tay

Example 2: convert outlook email to text file python

import email
from emaildata.attachment import Attachment

message = email.message_from_file(open('message.eml'))
for content, filename, mimetype, message in Attachment.extract(message):
    print filename
    with open(filename, 'w') as stream:
        stream.write(content)
    # If message is not None then it is an instance of email.message.Message
    if message:
        print "The file {0} is a message with attachments.".format(filename)