So here i am going to show a sample working script.
Pre requirements : python2.6
import smtplib
fromaddr = 'sender@gmail.com'
toaddrs = 'recipient@gmail.com'
msg = ' i am sending this trough my sample programe. this is really cool.. :-) send me a reply when u recieve this mail.'
# Credentials (if needed)
username = 'username'
password = 'password'
# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
Save this file as example.pyHow to run the script :
Go to the location of example.py and run following command.
python example.py
Then check you mail. :-)