UIDVAL_RESP = re.compile(r'(?P<name>.*) \(UIDVALIDITY (?P<uidval>.*)\)')
ACLS_RESP = re.compile(b'(?P<user>.*) (?P<acls>.*)')
-SERVER = "localhost"
-
class MailIterator:
"""This class communicates with the e-mail server."""
# logged in status
logged_in = None
- def __init__(self, username, password):
+ def __init__(self, server, username, password):
"""Creates a connection and a user session."""
# connect to server
try:
- self.mail_con = imaplib.IMAP4(SERVER)
+ self.mail_con = imaplib.IMAP4(server)
# socket functionality (currently unavailable)
#imap_socket = socket.socket(socket.AF_UNIX)
#self.mail_con.sock = imap_socket
#self.mail_con.file = self.mail_con.sock.makefile('rb')
- logging.info("Connected to %s", SERVER)
+ logging.info("Connected to %s", server)
except (socket.error, self.mail_con.error) as ex:
logging.error("Could not connect to host: %s", ex)
sys.exit()