#!/usr/bin/env python3
# ====================================================================
# From : www.geeksforgeeks.org/send-email-using-yagmail-in-python
# ====================================================================
import yagmail
user = 'user@xmail.com'
app_password = 'password'
to = 'to99@xmail.com'
# initiating connection with SMTP server
yag = yagmail.SMTP(user,app_password)
# Adding multiple attachments and mailing them
with yagmail.SMTP(user, app_password) as yag:
yag.send(to,'attachent test','see the attachments',
attachments=['./faces/known_image.png','graphics.pdf'])
print('email sent sucessfully')
## ---- original code from source
##yag.send(to,'attachent test','see the attachments',
## attachments=['./faces/known_image.png','graphics.pdf'])