Browse Source

Path to the credentials updated.

awesome-3.5
Kolan Sh 5 years ago
parent
commit
64b89b92a5
2 changed files with 14 additions and 7 deletions
  1. +6
    -3
      mail_loop_gmail.py
  2. +8
    -4
      mail_loop_mymail.py

+ 6
- 3
mail_loop_gmail.py 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)")


+ 8
- 4
mail_loop_mymail.py 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()


Loading…
Cancel
Save