Exchange is a library for sending, reading, and deleting emails. Exchange is interfacing with Exchange Web Services (EWS).
For more information about server settings, see this Microsoft support article.
Examples
Robot Framework
*** Settings *** Library RPA.Email.Exchange Task Setup Authorize username=${ACCOUNT} password=${PASSWORD} *** Variables *** ${ACCOUNT} ACCOUNT_NAME ${PASSWORD} ACCOUNT_PASSWORD ${RECIPIENT_ADDRESS} RECIPIENT ${IMAGES} myimage.png ${ATTACHMENTS} C:${/}files${/}mydocument.pdf *** Tasks *** Task of sending email Send Message recipients=${RECIPIENT_ADDRESS} ... subject=Exchange Message from RPA Robot ... body=<p>Exchange RPA Robot message body<br><img src='myimage.png'/></p> ... save=${TRUE} ... html=${TRUE} ... images=${IMAGES} ... cc=EMAIL_ADDRESS ... bcc=EMAIL_ADDRESS ... attachments=${ATTACHMENTS} Task of listing messages # Attachments are saved specifically with a keyword Save Attachments ${messages}= List Messages FOR ${msg} IN @{messages} Log Many ${msg} ${attachments}= Run Keyword If "${msg}[subject]"=="about my orders" ... Save Attachments ... ${msg} ... save_dir=${CURDIR}${/}savedir END # Using save_dir all attachments in listed messages are saved ${messages}= List Messages ... INBOX/Problems/sub1 ... criterion=subject:about my orders ... save_dir=${CURDIR}${/}savedir2 FOR ${msg} IN @{messages} Log Many ${msg} END Task of moving messages Move Messages criterion=subject:about my orders ... source=INBOX/Processed Purchase Invoices/sub2 ... target=INBOX/Problems/sub1
Python
from RPA.Email.Exchange import Exchange ex_account = "ACCOUNT_NAME" ex_password = "ACCOUNT_PASSWORD" mail = Exchange() mail.authorize(username=ex_account, password=ex_password) mail.send_message( recipients="RECIPIENT", subject="Message from RPA Python", body="RPA Python message body", )