Python Library: Yagmail

GMAIL/SMTP client that aims to make it as simple as possible to send emails.

06 Apr 2022

Library resources
PyPI https://pypi.org/project/yagmail/
Github https://github.com/kootenpv/yagmail
Documentation http://yagmail.readthedocs.io/en/latest/

pip3 install yagmail

import yagmail

yag = yagmail.SMTP(XX_EMAIL, XX_PASSWORD)

body = 'email body\nformattted as needed' 

content = [
            body,
            # additional elements can be added to list, eg: 
            '', 
            yagmail.inline("minions.gif"), # to insert images inline
            '\n\nNic', # signature can be managed as variable in list
            ]

yag.send(to=email, bcc=bcc, subject=subject, contents=content)

links

social