Skip to content

Instantly share code, notes, and snippets.

@cupofcodeblog
Created October 21, 2023 17:28
shoe-maker: simple email sending
...
FILES_PATHS=["dir/containing/image","image2"]
try:
with smtplib.SMTP('smtp.gmail.com', 587) as smtp:
smtp.starttls()
smtp.ehlo()
smtp.login(GMAIL_ADDR, APP_PASSWORD)
subject = 'Testing plain text email'
body = 'Testing plain text body'
msg = f'Subject: {subject}\n\n{body}'
smtp.sendmail(fromaddr=GMAIL_ADDR, to_addrs=GMAIL_ADDR, msg=msg)
print('Sent successfully!')
except Exception as e:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment