Use str.strip for compatibility with Python 3.
Support both configparser and ConfigParser for compatibility with Python 3.
Leverage IMAP search to identify the messages to delete.

Instead of going through the whole folder, which can easily be _huge_,
leverage the ability to search for all messages sent before a given
date to fetch everything from maxage+1 days ago and earlier.

This makes it possible to fetch much less data than before, especially
when doing the cleanup daily.
Use BODY.PEEK to avoid having to store/restore the \Seen flag.
Fetch and process all messages right after the search.

Thanks to IMAP4's search and peek capabilities, it's easier to just
iterate over all the messages found once, rather than having a number
of iterations over the same data.
Use email.message_from_string instead of reimplementing it.
Pre-format the trash folder name.
Pre-calculate what action to print, to reduce the branching.