Path to the credentials updated.

This commit is contained in:
Kolan Sh 2014-08-16 15:19:58 +04:00
parent ec35d5c8e1
commit 64b89b92a5
2 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,14 @@
#!/usr/bin/python
# Create credentials.py with gmail_login and gmail_password variables
# Create ~/.local/share/keyrings/mail_loop_keys.py:
# gmail_login = 'username'
# gmail_password = 'password'
import imaplib
import imaplib,sys,os
try:
from credentials import gmail_login,gmail_password
sys.path.insert (0, os.getenv("HOME")+"/.local/share/keyrings")
from mail_loop_keys import gmail_login,gmail_password
M=imaplib.IMAP4_SSL("imap.gmail.com", 993)
M.login(gmail_login,gmail_password)
status, counts = M.status("Inbox","(MESSAGES UNSEEN)")

View File

@ -1,8 +1,12 @@
#!/usr/bin/python
# Create credentials.py with mymail_login, mymail_password, mymail_server, mymail_port variables
# Create ~/.local/share/keyrings/mail_loop_keys.py:
# mymail_server = 'imap.example.com'
# mymail_port = 143
# mymail_login = 'username'
# mymail_password = 'password'
import imaplib,ssl
import imaplib,ssl,sys,os
# http://stackoverflow.com/questions/9713055/certificate-authority-for-imaplib-and-poplib-python
import imaplib,ssl
@ -17,8 +21,8 @@ imaplib.IMAP4.__dict__['starttls']=IMAP_starttls
imaplib.Commands['STARTTLS']=('NONAUTH',)
try:
# read credentials
from credentials import mymail_server,mymail_port,mymail_login,mymail_password
sys.path.insert (0, os.getenv("HOME")+"/.local/share/keyrings")
from mail_loop_keys import mymail_server,mymail_port,mymail_login,mymail_password
M=imaplib.IMAP4(mymail_server, mymail_port)
M.starttls()