mailtool
The following mailboxes can be accessed by mailtool:
imap://userid@server[/options]
imaps://userid@server[/options]
pop3://userid@server[/options]
pop3s://userid@server[/options]
maildir:path
mbox:path
inbox:path
The name of a remote IMAP or POP3 server may be followed by one or more options that control various settings of the IMAP or POP3 connection:
/cram
Secure password authentication is not supported by all servers. This option may not work with some servers. This option does not enable secure password authentication, it only mandates its use. If the server supports secure password authentication, it will be used even without the /cram option. Traditional userid/password authentication will be used only if the server does not implement secure password authentication. The /cram option makes secure password authentication mandatory.
The /cram option is marginally useful even with encrypted server connections. The secure password authentication never sends the explicit password to the server. Encryption makes it theoretically impossible to recover the password from an encrypted data connection; but with secure authentication the password is never sent over the connection in the first place (the password's validity is certified by exchanging certain mathematical calculations between the server and the client). If the server is compromised, the compromised server will not receive the account password (unless the password is recovered from the server in other ways).
/imap
/notls
/novalidate-cert
The encrypted connection normally fails if the certificate cannot be validate. Validation requires that a list of trusted certificate authorities must be known and configured. It's simply impossible to know which certificate authorities are valid without an explicit list of valid, known, trusted, certificate authorities. If a trusted authority list is not configured, no certificate can be validated. If the server's certificate is a self-signed certificate (this is often used for testing purposes), or if it's not signed by a known authority, the encrypted connection fails.
This /novalidate-cert option disables certificate validation. The encrypted connection will be established even if the server's certificate would otherwise be rejected.
-tree
mailtool -tree imap://jsmith@mail.example.com/novalidate-cert/cram
-create
mailtool -create INBOX.lists announcements maildir:Maildir
This command creates a new folder "announcements" as a subfolders of "INBOX.lists" in the local maildir.
-delete
-deletedir deletes a folder directory.
mailtool -delete INBOX.lists.announcements maildir:Maildir
-renames
mailtool -rename INBOX.lists.announcements INBOX.lists Announcements maildir:Maildir
The folder "INBOX.lists.announcements" is renamed to "INBOX.lists.Announcements". This slightly unusual way to rename folder allows folders to be relocated in the mail account's folder hierarchy.
-index
mailtool -index INBOX imap://john@mail.example.com/novalidate-cert
-remove
n may be a comma-separated list of message numbers, in strictly numerically increasing order. -remove confirms the list of messages to remove and issues a "Ready:" prompt. Press ENTER to remove the messages.
mailtool -remove INBOX 28,31 imap://john@mail.example.com/novalidate-cert
-filter
mailtool -filter INBOX pop3://john@mail.example.com/novalidate-cert
-filter is not meant to be used with large folders. Unless messages are removed quickly, the connection to the server may be disconnected for inactivity.
mailtool -tofolder INBOX -copyto maildir:Maildir \
-fromfolder "INBOX" imap://mbox100@mail.example.com/novalidate-cert
mailtool -recurse -tofolder INBOX.converted_mail \
-copyto maildir:Maildir -fromfolder "mail" \
imap://mbox100@mail.example.com/novalidate-cert
This example first copies the INBOX on the IMAP server to $HOME/Maildir, then copies subfolders of "mail" on the IMAP server to the "converted_mail" subfolder in the maildir.
mailtool -tofolder INBOX -copyto maildir:Maildir \
-fromfolder "INBOX" inbox:mail
mailtool -recurse -tofolder INBOX.converted_mail \
-copyto maildir:Maildir -fromfolder "" mbox:mail
This example first copies $HOME/Inbox (accessed as the INBOX folder in inbox:mail) to $HOME/Maildir, then copies mbox folders from $HOME/mail to the "converted_mail" subfolder in the maildir.
Mail accounts that contain hybrid folders (folders that contain both messages and subfolders) can only be copied to account types that also support hybrid folders: either local maildirs, or to remote servers that support hybrid folders.
cone(1).