Created
January 23, 2017 13:00
-
-
Save vernwalrahul/4dd94ab5024554bfbd3b1f991823862f to your computer and use it in GitHub Desktop.
To send a mail using smtp server from python code. Sample code.
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 | |
import socks | |
fromaddr = input('sender email: ') | |
toaddrs = input('receiver email: ') | |
msg = input('message') | |
username = input('your email: ') | |
password = input('your password: ') | |
server = smtplib.SMTP('smtp.gmail.com:587') | |
server.ehlo() | |
server.starttls() | |
server.login(username,password) | |
server.sendmail(fromaddr, toaddrs, msg) | |
print('email sent') | |
server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment