Created
March 17, 2015 15:34
-
-
Save cstrap/b4541c78c806e8d8ad1a to your computer and use it in GitHub Desktop.
Integrate mailtrap.io - plain python
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('There was a terrible error that occured and I wanted you to know!') | |
msg['Subject'] = 'Hello world' | |
msg['From'] = 'from@example.com' | |
msg['To'] = 'to@example.com' | |
username = 'mailtrap.io username' | |
password = 'mailtrap.io password' | |
# The actual mail send | |
server = smtplib.SMTP('mailtrap.io', 2525) | |
server.starttls() | |
server.login(username,password) | |
server.sendmail('from@example.com', ['to@example.com'], msg.as_string()) | |
server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment