I've done some Python programming, but I still consider myself a Python newbie. I have tried the following on Windows XP and a Mac Pro OS X 10.5.8 system on which I just installed Python 2.6.2.
I was working through Matt Wilson's article on using the logging module:
(If that does not work, then try: ). Everything worked great until his last example. My ISP does not provide e-mail, so I tried using gmail in the line that sets h2. I substituted "mailid" for my actual e-mail address in the following examples; in my test I used my actual e-mail ID.
First attempt:
h2 = logging.handlers.SMTPHandler('smtp.gmail.com', 'mailid@gmail.com', ['mailid@gmail.com'],'ERROR log')
However, that caused the following error to be issued:
Traceback (most recent call last):
File "c:\python26\lib\logging\handlers.py", line 868, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
File "c:\python26\lib\smtplib.py", line 698, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first. 7sm5811915qwb.24', mailid@gmail.com')
I also tried providing my gmail userid/password by adding a 5th, credential, argument, which is a tupple, (username,password) (new in 2.6):
class logging.handlers.SMTPHandler(mailhost, fromaddr, toaddrs, subject[, credentials])
Second attempt:
h2 = logging.handlers.SMTPHandler('smtp.gmail.com', 'mailid@gmail.com', ['mailid@gmail.com'],'ERROR log',('mailid@gmail.com','gmailpassword'))
However, that caused the following error message:
Traceback (most recent call last):
File "c:\python26\lib\logging\handlers.py", line 867, in emit
smtp.login(self.username, self.password)
File "c:\python26\lib\smtplib.py", line 552, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.
I am able access gmail via Outlook Express, in which I do have to specify my gmail userid/password.
Would someone please point out what I am doing incorrectly?
Thanks,
Bev in TX
I was working through Matt Wilson's article on using the logging module:
(If that does not work, then try: ). Everything worked great until his last example. My ISP does not provide e-mail, so I tried using gmail in the line that sets h2. I substituted "mailid" for my actual e-mail address in the following examples; in my test I used my actual e-mail ID.
First attempt:
h2 = logging.handlers.SMTPHandler('smtp.gmail.com', 'mailid@gmail.com', ['mailid@gmail.com'],'ERROR log')
However, that caused the following error to be issued:
Traceback (most recent call last):
File "c:\python26\lib\logging\handlers.py", line 868, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
File "c:\python26\lib\smtplib.py", line 698, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first. 7sm5811915qwb.24', mailid@gmail.com')
I also tried providing my gmail userid/password by adding a 5th, credential, argument, which is a tupple, (username,password) (new in 2.6):
class logging.handlers.SMTPHandler(mailhost, fromaddr, toaddrs, subject[, credentials])
Second attempt:
h2 = logging.handlers.SMTPHandler('smtp.gmail.com', 'mailid@gmail.com', ['mailid@gmail.com'],'ERROR log',('mailid@gmail.com','gmailpassword'))
However, that caused the following error message:
Traceback (most recent call last):
File "c:\python26\lib\logging\handlers.py", line 867, in emit
smtp.login(self.username, self.password)
File "c:\python26\lib\smtplib.py", line 552, in login
raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.
I am able access gmail via Outlook Express, in which I do have to specify my gmail userid/password.
Would someone please point out what I am doing incorrectly?
Thanks,
Bev in TX