# pymailer A very simple CLI mail client written in Python. Written to fulfil some specific requirements I had for automated mail server testing. Relies on Python's built in `smptlib` for sending mails, and [IMAPClient](https://pypi.org/project/IMAPClient/) for inbox actions. Pymailer can - Send an email via SMTP - Connect to an inbox via IMAP and - List emails - Search for emails - Delete emails that match search criteria ## Install Either download the Python file from the repo and install dependencies via `pip`, or download the latest release as a single-file application built by [PyInstaller](https://pypi.org/project/pyinstaller/) from the [Releases](https://git.mrmeeb.stream/MrMeeb/pymailer/releases) page. No Python required. ## Usage ``` usage: pymailer [-h] {send,message_list,message_search,message_delete} ... Simple mail client for sending emails, and checking and manipulating an inbox optional arguments: -h, --help show this help message and exit subcommands: {send,message_list,message_search,message_delete} available subcommands send send an email message_list lists all messages in an inbox via IMAP message_search search an inbox for messages via IMAP message_delete deletes messages in an inbox via IMAP ``` ``` usage: pymailer send [-h] --smtp_host SMTP_HOST --smtp_user SMTP_USER --smtp_password SMTP_PASSWORD --from_addr FROM_ADDR --to_addr TO_ADDR --subject SUBJECT --body BODY [--debug_level {0,1,2}] optional arguments: -h, --help show this help message and exit --smtp_host SMTP_HOST SMTP server hostname --smtp_user SMTP_USER SMTP server logon username --smtp_password SMTP_PASSWORD SMTP server logon password --from_addr FROM_ADDR Address to send email from --to_addr TO_ADDR Address to send email to --subject SUBJECT Email subject --body BODY Email body --debug_level {0,1,2} Debug level, higher number is more verbose ``` ``` usage: pymailer message_list [-h] --imap_host IMAP_HOST --imap_user IMAP_USER --imap_password IMAP_PASSWORD [--folder FOLDER] optional arguments: -h, --help show this help message and exit --imap_host IMAP_HOST IMAP server hostname --imap_user IMAP_USER IMAP server logon username --imap_password IMAP_PASSWORD IMAP server logon password --folder FOLDER Inbox folder ``` ``` usage: pymailer message_search [-h] --imap_host IMAP_HOST --imap_user IMAP_USER --imap_password IMAP_PASSWORD [--folder FOLDER] --search_string [SEARCH_STRING ...] optional arguments: -h, --help show this help message and exit --imap_host IMAP_HOST IMAP server hostname --imap_user IMAP_USER IMAP server logon username --imap_password IMAP_PASSWORD IMAP server logon password --folder FOLDER Inbox folder --search_string [SEARCH_STRING ...] Search string e.g 'FROM' 'user@example.com'. Space separated ``` ``` usage: pymailer message_delete [-h] --imap_host IMAP_HOST --imap_user IMAP_USER --imap_password IMAP_PASSWORD [--folder FOLDER] --search_string [SEARCH_STRING ...] [--dry_run {true,false}] optional arguments: -h, --help show this help message and exit --imap_host IMAP_HOST IMAP server hostname --imap_user IMAP_USER IMAP server logon username --imap_password IMAP_PASSWORD IMAP server logon password --folder FOLDER Inbox folder --search_string [SEARCH_STRING ...] Search string for emails that will be deleted e.g 'FROM' 'user@example.com'. Space separated --dry_run {true,false} List emails that will be deleted, but don't delete them ```