Ejemplo n.º 1
0
def main():
    logger.info( "IMAP collector started" )

    threads = []
    for account in get_email_accounts():
        t = threading.Thread(target=check_mailbox, args=(account,), daemon=True)
        t.start()
        threads.append(t)
    for t in threads:
        t.join()
Ejemplo n.º 2
0
# Get output files from OUTqueue and send them to users


import email, email.mime.application, email.mime.base, email.mime.multipart, email.mime.text, json, os, os.path, re, smtplib

import paths
import config
from config import logger_summary
from config import get_email_accounts
from queues import consume_queue


logger = config.logging.getLogger(__name__)

accounts = get_email_accounts()


with open( os.path.join(paths.base_dir, "mail_failure.txt"), "r" ) as fh:
    mail_failure_message = fh.read()


def sendMail(item):
    message = email.mime.multipart.MIMEMultipart('mixed')
    message['Message-ID'] = email.utils.make_msgid()
    message['In-Reply-To'] = message['References'] = item['email_Message-ID']
    message['Subject'] = 'Re: ' + item['email_Subject']
    message['To'] = item['email_From']
    message['From'] = item['email_To']

    if item['processed_successfully']: