Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_next_mail(pop_url, pop_port, get_email, get_passwd):
- mail = poplib.POP3_SSL(pop_url, pop_port)
- mail.user(get_email)
- mail.pass_(get_passwd)
- if len(mail.list()[1]) > 0:
- tmp = ''.join(mail.retr(1)[1])
- # 'mail.dele(1)' seems to be ignored by gmail, configure in mail setting
- # as delete on POP access instead
- mail.dele(1)
- mail.quit()
- return tmp
- else:
- return ''
- def get_attachment(pop_url, pop_port, get_email, get_passwd):
- email_str = get_next_mail(pop_url, pop_port, get_email, get_passwd)
- msg = email.message_from_string(email_str)
- print msg.walk()
- print msg.is_multipart()
- print msg.get_payload()
- I get the following when executed ...
- dave@main-system:~/kindle_daemon$ ./kd.py
- <generator object walk at 0x9c3961c>
- False
- dave@main-system:~/kindle_daemon$
- get_attachment(pop_url, pop_port, get_email, get_passwd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement