예제 #1
0
def process_letters_pop3(messages, filename_filter_applied, quiet=False):
    """
    Proxy to process all letters in queue one by one.
    """
    for message in messages:
        try:
            process_single_letter(message, filename_filter_applied, quiet=quiet)
            if not quiet:
                print "Done converting/saving attachments..."
        except:
            if not quiet:
                print "Error processing message!"
            return "Error"
    return "Done"
예제 #2
0
def process_letters_imap(emails,
                         email_obj,
                         filename_filter,
                         mail_folder,
                         quiet=False):
    """
    Processes a list of fetched messages ID's
    for e.g.: ['1 2 3']
    Returns list of lists of attachment's filenames for every email processed
    for e.g.: [ ['filename1.txt', 'filename2.txt'], ['filenae3.txt', 'filename4.txt', filename5.txt' ... ], ... ]
    """
    letters = emails[0].split()
    result = []
    for letter_number in letters:
        if not quiet:
            print "About to fetch email ID's: " + str(letter_number)
        status, data = mail_folder.fetch(letter_number, '(RFC822)')
        # uncomment to print formated message
        #print 'Message %s\n%s\n' % (letter_number, data[0][1])
        result += process_single_letter(msg=data,
                                        filter_filename=filename_filter,
                                        quiet=quiet)
        if email_obj.delete_messages_flag:
            delete_letter_imap(letter_number=letter_number,
                               mail_folder=mail_folder,
                               quiet=quiet)
    return result
예제 #3
0
def process_letters_pop3(messages, filename_filter_applied, quiet=False):
    """
    Proxy to process all letters in queue one by one.
    """
    for message in messages:
        try:
            process_single_letter(message,
                                  filename_filter_applied,
                                  quiet=quiet)
            if not quiet:
                print 'Done converting/saving attachments...'
        except:
            if not quiet:
                print 'Error processing message!'
            return 'Error'
    return 'Done'