email from windows

prakash jp prakash.stack at gmail.com
Sun Mar 29 23:28:49 EDT 2009


preexistant code :

import sys, smtplib
import string
fromaddr = raw_input("From: ")
toaddrs  = string.splitfields(raw_input("To: "), ',')
print "Enter message, end with ^D:"
msg = ''
count = 3
while count > 0:
    line = sys.stdin.readline()
    #if not line:
    #    break
    msg = msg + line
    count = count -1
    # The actual mail send
server = smtplib.SMTP('localhost')
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

-----
Running the program:
------------------------------------------
From: prakash.stack at gmail.com
To: prakash.stack at gmail.com
hai
how r
u
---------------------------
error creeps in :
error says::::

Traceback (most recent call last):
  File "C:\Python25\python-collection\mail\mail.py", line 17, in <module>
    server = smtplib.SMTP('localhost')
  File "C:\Python25\lib\smtplib.py", line 244, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python25\lib\smtplib.py", line 310, in connect
    raise socket.error, msg
error: (10061, 'Connection refused')

On Mon, Mar 30, 2009 at 7:40 AM, prakash jp <prakash.stack at gmail.com> wrote:

> Hi all,
>
> In windows environment, how to send email from one gmail address to another
> gmail (or another mail) addrress
>
>
> Regards
> Prakash
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090330/7c1d33ae/attachment-0001.html>


More information about the Python-list mailing list