Install like this:
pip install emailx
Use like this:
from emailx import Email, smtp_connection
SMTP = 'smtp.example.com'
LOGIN = ('alex', 'password123')
dummy_recipients = 'Alex <[email protected]>'
with smtp_connection(SMTP, LOGIN) as c:
e = Email(
source='Alex <[email protected]>',
subject='Hello',
body='Body',
html_body='<html>Body</html>',
to_addresses='Bobby <[email protected]',
bcc_addresses='Kim <[email protected]>',
attachments={
'a.csv': csv_data
}
)
c.send(e)