Created
January 26, 2019 16:15
-
-
Save j33ty/e3c7eec954ebdacb0047899975c72bb9 to your computer and use it in GitHub Desktop.
Send mail from terminal via any Mail Service using their API keys. This is for testing multiple Mail providers during outage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from email.mime.text import MIMEText | |
msg = MIMEText('Loved your locker room talk!') | |
msg['Subject'] = 'Not so confidential stuff here' | |
msg['From'] = 'pladimir.vutin@russia.com' | |
msg['To'] = 'tonald.dump@us.com' | |
s = smtplib.SMTP('smtp.sendgrid.net', 465) | |
s.starttls() | |
s.login('apikey', | |
'apisecret') | |
s.sendmail(msg['From'], msg['To'], msg.as_string()) | |
s.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment