Problem occured while sending mail
this is my code import sys, os, glob, datetime, time import smtplib ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= '[EMAIL PROTECTED]' pw= 'fill in here' SENDER= SMTPuser ## Message details FROM= SENDER TO= '[EMAIL PROTECTED]' CC=FROM ##RECEIVERS= (TO, CC) ##proper way to send to both TO and CC RECEIVERS= (TO,) ## ignore the CC address subject= 'Test 1a' message='*** Email test *** ' print 'Starting SMTP mail session on %s as %s ' % (SMTPserver,SMTPuser) session = smtplib.SMTP(SMTPserver,port) session.set_debuglevel(0) # set debug level to 1 to see details session.ehlo(SMTPuser) # say hello session.starttls() # TLS needed session.ehlo(SMTPuser) # say hello again, not sure why session.login(SMTPuser, pw) ##Create HEADER + MESSAGE HEADER= 'From: %s\r\n' % FROM HEADER= HEADER + 'To: %s\r\n' % TO HEADER= HEADER + 'Cc: %s\r\n' % CC HEADER= HEADER + 'Subject: %s\r\n' % subject BODY= HEADER + '\r\n' + message print BODY SMTPresult = session.sendmail(SENDER, RECEIVERS, BODY) ## send email session.close() Now when i run this .py file...as python mail.py i can see only statement starting smtp mail..n details then nothing on screen after few minutes or after pressing ctrl +c Traceback (most recent call last): File "mail4.py", line 21, in session = smtplib.SMTP(SMTPserver,port) File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) File "/usr/local/lib/python2.5/smtplib.py", line 301, in connect self.sock.connect(sa) File "", line 1, in connect or may be conncetion time out wats the solution for this -- http://mail.python.org/mailman/listinfo/python-list
Re: SMTP via GMAIL
On Aug 7, 12:40 am, mmm <[EMAIL PROTECTED]> wrote: > On Aug 5, 12:18 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > >But when using smtp.gmail.com as the server I learned that any > > >@gmail.com address in the Cc: text block would > > >receive mail even if I changed the code to have the RECEIVERS list to > > >ignore the CC addresses or not include the gmail address in the CC > > >list as below > > > Interesting. If true, that is incorrect behavior. > > I ran some more tests and now I am pretty sure > > session.sendmail(SENDER, RECEIVERS, BODY) > > is only sending to the RECEIVERS list, ignoring the Cc: field in the > body (as it should) > > What fooled me is that I was using my own gmail account (i.e., > [EMAIL PROTECTED]) as a Cc: field and not putting it in the RECEIVERS > list. It seems Gmail creates two links (or copies?) to the message: > (1) as it is stored in the SENT box (as it should since the message > was sent by my gmail account) and (2) another in my INBOX because the > mail reading software reads the Cc: field. > > Other smtp servers such as comcast do not create the stored SENT mail > and hence behave different in terms of how they treat Cc: fields of > the same account ([EMAIL PROTECTED] in this case). > > Most important, using another gmail account (not [EMAIL PROTECTED]) as a > Cc: field does not create another sent message (outside of what is in > the RECEIVERS field). > > Sorry for confusion, and I do appreciate the tips as I now see how > almost anything To:, Cc:, Bcc: combination can be handled by a proper > RECEIVERS list. > > Below is python code that can be used by anyone that wants to test > what I did (just fill in the SMTPuser and password variables) and > then check you gmail inbox > > import sys, os, glob, datetime, time > import smtplib > ## Parameters for SMTP session > port=587 > SMTPserver= 'smtp.gmail.com' > SMTPuser= '[EMAIL PROTECTED]' > pw= 'fill in here' > SENDER= SMTPuser > > ## Message details > FROM= SENDER > TO= '[EMAIL PROTECTED]' > CC=FROM > ##RECEIVERS= (TO, CC) ##proper way to send to both TO and CC > RECEIVERS= (TO,) ## ignore the CC address > > subject= 'Test 1a' > message='*** Email test *** ' > > print 'Starting SMTP mail session on %s as %s ' % > (SMTPserver,SMTPuser) > session = smtplib.SMTP(SMTPserver,port) > session.set_debuglevel(0) # set debug level to 1 to see details > session.ehlo(SMTPuser) # say hello > session.starttls() # TLS needed > session.ehlo(SMTPuser) # say hello again, not sure why > session.login(SMTPuser, pw) > > ##Create HEADER + MESSAGE > HEADER= 'From: %s\r\n' % FROM > HEADER= HEADER + 'To: %s\r\n' % TO > HEADER= HEADER + 'Cc: %s\r\n' % CC > HEADER= HEADER + 'Subject: %s\r\n' % subject > BODY= HEADER + '\r\n' + message > print BODY > > SMTPresult = session.sendmail(SENDER, RECEIVERS, BODY) ## send email > > session.close() i tried to run this code...but it didnt work it shows that message like starting smtp session then it doesnt show anything after very long time it shows Traceback (most recent call last): File "mail5.py", line 21, in session = smtplib.SMTP(SMTPserver,port) File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) File "/usr/local/lib/python2.5/smtplib.py", line 301, in connect self.sock.connect(sa) File "", line 1, in connect then conncetion time out. can u tell me wats the prob ...plz tell me solun -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem occured while sending mail
On Sep 17, 5:04 pm, sui <[EMAIL PROTECTED]> wrote: > this is my code > > import sys, os, glob, datetime, time > import smtplib > ## Parameters for SMTP session > port=587 > SMTPserver= 'smtp.gmail.com' > SMTPuser= '[EMAIL PROTECTED]' > pw= 'fill in here' > SENDER= SMTPuser > > ## Message details > FROM= SENDER > TO= '[EMAIL PROTECTED]' > CC=FROM > ##RECEIVERS= (TO, CC) ##proper way to send to both TO and CC > RECEIVERS= (TO,) ## ignore the CC address > > subject= 'Test 1a' > message='*** Email test *** ' > > print 'Starting SMTP mail session on %s as %s ' % > (SMTPserver,SMTPuser) > session = smtplib.SMTP(SMTPserver,port) > session.set_debuglevel(0) # set debug level to 1 to see details > session.ehlo(SMTPuser) # say hello > session.starttls() # TLS needed > session.ehlo(SMTPuser) # say hello again, not sure why > session.login(SMTPuser, pw) > > ##Create HEADER + MESSAGE > HEADER= 'From: %s\r\n' % FROM > HEADER= HEADER + 'To: %s\r\n' % TO > HEADER= HEADER + 'Cc: %s\r\n' % CC > HEADER= HEADER + 'Subject: %s\r\n' % subject > BODY= HEADER + '\r\n' + message > print BODY > > SMTPresult = session.sendmail(SENDER, RECEIVERS, BODY) ## send email > > session.close() > > Now when i run this .py file...as python mail.py > i can see only statement > starting smtp mail..n details > then nothing on screen after few minutes or after pressing ctrl +c > Traceback (most recent call last): > File "mail4.py", line 21, in > session = smtplib.SMTP(SMTPserver,port) > File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > (code, msg) = self.connect(host, port) > File "/usr/local/lib/python2.5/smtplib.py", line 301, in connect > self.sock.connect(sa) > File "", line 1, in connect > or may be conncetion time out > > wats the solution for this if i dont press cntrl + c then it shows Starting SMTP mail session on smtp.gmail.com as [EMAIL PROTECTED] Traceback (most recent call last): File "mail4.py", line 21, in session = smtplib.SMTP(SMTPserver,port) File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) File "/usr/local/lib/python2.5/smtplib.py", line 310, in connect raise socket.error, msg socket.error: (110, 'Connection timed out') plz help me its urgent.i want to complete it as early as possible -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem occured while sending mail
On Sep 17, 8:04 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > On Wed, 17 Sep 2008 05:28:05 -0700 (PDT), sui <[EMAIL PROTECTED]> wrote: > > On Sep 17, 5:04 pm, sui <[EMAIL PROTECTED]> wrote: > >> this is my code > > >> import sys, os, glob, datetime, time > >> import smtplib > >> ## Parameters for SMTP session > >> port=587 > >> SMTPserver= 'smtp.gmail.com' > >> SMTPuser= '[EMAIL PROTECTED]' > >> pw= 'fill in here' > >> SENDER= SMTPuser > > >> ## Message details > >> FROM= SENDER > >> TO= '[EMAIL PROTECTED]' > >> CC=FROM > >> ##RECEIVERS= (TO, CC) ##proper way to send to both TO and CC > >> RECEIVERS= (TO,) ## ignore the CC address > > >> subject= 'Test 1a' > >> message='*** Email test *** ' > > >> print 'Starting SMTP mail session on %s as %s ' % > >> (SMTPserver,SMTPuser) > >> session = smtplib.SMTP(SMTPserver,port) > >> session.set_debuglevel(0) # set debug level to 1 to see details > >> session.ehlo(SMTPuser) # say hello > >> session.starttls() # TLS needed > >> session.ehlo(SMTPuser) # say hello again, not sure why > >> session.login(SMTPuser, pw) > > >> ##Create HEADER + MESSAGE > >> HEADER= 'From: %s\r\n' % FROM > >> HEADER= HEADER + 'To: %s\r\n' % TO > >> HEADER= HEADER + 'Cc: %s\r\n' % CC > >> HEADER= HEADER + 'Subject: %s\r\n' % subject > >> BODY= HEADER + '\r\n' + message > >> print BODY > > >> SMTPresult = session.sendmail(SENDER, RECEIVERS, BODY) ## send email > > >> session.close() > > >> Now when i run this .py file...as python mail.py > >> i can see only statement > >> starting smtp mail..n details > >> then nothing on screen after few minutes or after pressing ctrl +c > >> Traceback (most recent call last): > >> File "mail4.py", line 21, in > >> session = smtplib.SMTP(SMTPserver,port) > >> File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > >> (code, msg) = self.connect(host, port) > >> File "/usr/local/lib/python2.5/smtplib.py", line 301, in connect > >> self.sock.connect(sa) > >> File "", line 1, in connect > >> or may be conncetion time out > > >> wats the solution for this > > > if i dont press cntrl + c then it shows > > Starting SMTP mail session on smtp.gmail.com as [EMAIL PROTECTED] > > Traceback (most recent call last): > > File "mail4.py", line 21, in > > session = smtplib.SMTP(SMTPserver,port) > > File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > > (code, msg) = self.connect(host, port) > > File "/usr/local/lib/python2.5/smtplib.py", line 310, in connect > > raise socket.error, msg > > socket.error: (110, 'Connection timed out') > > > plz help me its urgent.i want to complete it as early as possible > > I pasted your code into a file named temp.py, > and (perhaps superstitiously) added a backslash to this line: > > >> print 'Starting SMTP mail session on %s as %s ' % > > Here's what it does (long line wrapped manually): > > [EMAIL PROTECTED]:~$ python temp.py > Starting SMTP mail session on smtp.gmail.com as [EMAIL PROTECTED] > Traceback (most recent call last): > File "temp.py", line 27, in ? > session.login(SMTPuser, pw) > File "/usr/lib/python2.4/smtplib.py", line 591, in login > raise SMTPAuthenticationError(code, resp) > smtplib.SMTPAuthenticationError: (535, \ >'5.7.1 Username and Password not accepted. Learn more at\n' \ >'5.7.1http://mail.google.com/support/bin/answer.py?answer='\ >'14257 a8sm34686663poa.12') > [EMAIL PROTECTED]:~$ > > This indicates that it got much farther than when you ran it, since > your timeout message comes from the smtplib.SMTP call several lines > before the session.login call. > > As a simple connectivity test, you might see whether you can connect > using telnet: > > [EMAIL PROTECTED]:~$ telnet smtp.gmail.com 587 > Trying 72.14.253.109... > Connected to gmail-smtp.l.google.com. > Escape character is '^]'. > 220 mx.google.com ESMTP m27sm34789033pof.6 > ^]c > > telnet> c > Connection closed. > [EMAIL PROTECTED]:~$ > > -- > To email me, substitute nowhere->spamcop, invalid->net. Actually i m working at place where proxy server has been working..so is it problem caused by that proxy server..peter thnks for suggestion but still its not working.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem occured while sending mail
On Sep 17, 8:04 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > On Wed, 17 Sep 2008 05:28:05 -0700 (PDT), sui <[EMAIL PROTECTED]> wrote: > > On Sep 17, 5:04 pm, sui <[EMAIL PROTECTED]> wrote: > >> this is my code > > >> import sys, os, glob, datetime, time > >> import smtplib > >> ## Parameters for SMTP session > >> port=587 > >> SMTPserver= 'smtp.gmail.com' > >> SMTPuser= '[EMAIL PROTECTED]' > >> pw= 'fill in here' > >> SENDER= SMTPuser > > >> ## Message details > >> FROM= SENDER > >> TO= '[EMAIL PROTECTED]' > >> CC=FROM > >> ##RECEIVERS= (TO, CC) ##proper way to send to both TO and CC > >> RECEIVERS= (TO,) ## ignore the CC address > > >> subject= 'Test 1a' > >> message='*** Email test *** ' > > >> print 'Starting SMTPmailsession on %s as %s ' % > >> (SMTPserver,SMTPuser) > >> session = smtplib.SMTP(SMTPserver,port) > >> session.set_debuglevel(0) # set debug level to 1 to see details > >> session.ehlo(SMTPuser) # say hello > >> session.starttls() # TLS needed > >> session.ehlo(SMTPuser) # say hello again, not sure why > >> session.login(SMTPuser, pw) > > >> ##Create HEADER + MESSAGE > >> HEADER= 'From: %s\r\n' % FROM > >> HEADER= HEADER + 'To: %s\r\n' % TO > >> HEADER= HEADER + 'Cc: %s\r\n' % CC > >> HEADER= HEADER + 'Subject: %s\r\n' % subject > >> BODY= HEADER + '\r\n' + message > >> print BODY > > >> SMTPresult = session.sendmail(SENDER, RECEIVERS, BODY) ## send email > > >> session.close() > > >> Now when i run this .py file...as pythonmail.py > >> i can see only statement > >> starting smtpmail..n details > >> then nothing on screen after few minutes or after pressing ctrl +c > >> Traceback (most recent call last): > >> File "mail4.py", line 21, in > >> session = smtplib.SMTP(SMTPserver,port) > >> File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > >> (code, msg) = self.connect(host, port) > >> File "/usr/local/lib/python2.5/smtplib.py", line 301, in connect > >> self.sock.connect(sa) > >> File "", line 1, in connect > >> or may be conncetion time out > > >> wats the solution for this > > > if i dont press cntrl + c then it shows > > Starting SMTPmailsession on smtp.gmail.com as [EMAIL PROTECTED] > > Traceback (most recent call last): > > File "mail4.py", line 21, in > > session = smtplib.SMTP(SMTPserver,port) > > File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > > (code, msg) = self.connect(host, port) > > File "/usr/local/lib/python2.5/smtplib.py", line 310, in connect > > raise socket.error, msg > > socket.error: (110, 'Connection timed out') > > > plz help me its urgent.i want to complete it as early as possible > > I pasted your code into a file named temp.py, > and (perhaps superstitiously) added a backslash to this line: > > >> print 'Starting SMTPmailsession on %s as %s ' % > > Here's what it does (long line wrapped manually): > > [EMAIL PROTECTED]:~$ python temp.py > Starting SMTPmailsession on smtp.gmail.com as [EMAIL PROTECTED] > Traceback (most recent call last): > File "temp.py", line 27, in ? > session.login(SMTPuser, pw) > File "/usr/lib/python2.4/smtplib.py", line 591, in login > raise SMTPAuthenticationError(code, resp) > smtplib.SMTPAuthenticationError: (535, \ >'5.7.1 Username and Password not accepted. Learn more at\n' \ >'5.7.1http://mail.google.com/support/bin/answer.py?answer='\ >'14257 a8sm34686663poa.12') > [EMAIL PROTECTED]:~$ > > This indicates that it got much farther than when you ran it, since > your timeout message comes from the smtplib.SMTP call several lines > before the session.login call. > > As a simple connectivity test, you might see whether you can connect > using telnet: > > [EMAIL PROTECTED]:~$ telnet smtp.gmail.com 587 > Trying 72.14.253.109... > Connected to gmail-smtp.l.google.com. > Escape character is '^]'. > 220 mx.google.com ESMTP m27sm34789033pof.6 > ^]c > > telnet> c > Connection closed. > [EMAIL PROTECTED]:~$ > > -- > To email me, substitute nowhere->spamcop, invalid->net. even i couldnt connect using telnet msg comes host is down -- http://mail.python.org/mailman/listinfo/python-list
python & sms
Hii i want a script to send sms to any mobile. can u help me ?? Thanks in advance.. -- http://mail.python.org/mailman/listinfo/python-list
Re: python & sms
On Sep 30, 10:10 am, "James Mills" <[EMAIL PROTECTED]> wrote: > sui, > > I am sure you'll find many web services > that you can use to send SMS'. Your > problem would then become one of > learning how to communicate and access > web services in Python. Start with: > * urllib and urllib2 > * xmlrpc > > There are others... > > cheers > James > > On Tue, Sep 30, 2008 at 1:47 PM, sui <[EMAIL PROTECTED]> wrote: > > Hii > > i want a script to send sms to any mobile. > > can u help me ?? > > > Thanks in advance.. > > -- > >http://mail.python.org/mailman/listinfo/python-list > > -- > -- > -- "Problems are solved by method" kk..wil try to use that... I thought if someone has already worked with it den it will be helpful thnks & cheers -- http://mail.python.org/mailman/listinfo/python-list
