email from windows
David Lyon
david.lyon at preisshare.net
Sun Mar 29 23:32:03 EDT 2009
Hi Prakash,
You need to tell the system your smtp host...
ie
> server = smtplib.SMTP('localhost')
needs to read something like
server = smtplib.SMTP('smtp.myisp.in')
On Mon, 30 Mar 2009 08:58:49 +0530, prakash jp <prakash.stack at gmail.com>
wrote:
> 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
>>
More information about the Python-list
mailing list