code for sending mail in Python

if you want to send mail using python .Here is the code……..

————————————————————————–

import sys, smtplib

fromaddr = raw_input(“From: “)
toaddrs = raw_input(“To: “).split(‘,’)
print “Enter message, end with ^D:”
msg = ‘this is code for sending mail’
#while 1:
# line = sys.stdin.readline()
# if not line:
# break
#msg = msg + line

# The actual mail send

server = smtplib.SMTP(host=’192.168.36.200′)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
————————————————————————————
instead of writing 192.168.36.200 write your mail server name .

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: