Friday, February 10, 2012

Sending emails using a python script

 I have scene many programmers prefer to use python scripts to send those emails.

So here i am going to show a sample working script.

Pre requirements  : python2.6

import smtplib

fromaddr = ''

toaddrs  = ''

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('')



server.sendmail(fromaddr, toaddrs, msg)

Save this file as
How to run the script :      
    Go to the location of and run following command.    
Then check you mail. :-)

No comments:

Post a Comment