The mailutils imap command invokes an interactive IMAP4 client shell. It reads commands from the standard input, executes them and displays the results on the standard output. The shell is similar to the mailutils pop shell, which see.
IMAP protocol commands
Most commands in this group correspond (with minor differences) to IMAP commands described in RFC 3501.
- connect [-tls] hostname [port]
- Open connection to hostname. If the -tls option is given, TLS encryption (also known as IMAPS protocol) will be used. If port argument is not supplied, the command uses port 143 for a plain IMAP connection or 993 for IMAPS (if -tls is given).
- capability [-reread] [name...]
- List server capabilities. Any number of name arguments is accepted. If given, the shell will display only the named capabilities, otherwise it displays the entire list. By default capability reuses the response of its previous invocation (if there was any), instead of resending the CAPABILITY command to the server. To force it do so, use the -reread option.
- Start TLS negotiation. This command is valid only after unencrypted connection has been successfully initiated using connect without -tls argument.
- login user [pass]
- Login to the server as user with password pass. If the pass argument is omitted, the shell will ask you to enter it. While entering, both echoing and history recording will be disabled. Use this to avoid compromising your password.
- Quit imap session
- id [-test kw] [arg [arg...]]
- Send IMAP ID command. See RFC 2971, for a discussion of arguments. By default, this command outputs entire ID list. If, however, the -test kw option is given, it will check whether the keyword kw is defined and display its value if so.
- Request a server checkpoint.
- select [mbox]
- Select a mailbox. Without argument, selects "INBOX".
- examine [mbox]
- Examine a mailbox, i.e. select it in read-only mode. If mbox is not given, "INBOX" is assumed.
- status mbox kw [kw...]
- Get mailbox status. Valid keywords (kw) are: MESSAGES, RECENT, UIDNEXT, UIDVALIDITY, and UNSEEN. Keywords are case-insensitive.
- fetch msgset items
- Fetch message data. See RFC 3501, section 6.4.5, for a discussion of its arguments.
- store msgset items
- Alter mailbox data. See RFC 3501, section 6.4.6, for a discussion of its arguments.
- Close the mailbox (with expunge).
- Close the mailbox (without expunge).
- delete mbox
- Delete the mailbox.
- rename old-name new-name
- Rename existing mailbox old-name to new-name
- Permanently remove messages marked for deletion.
- create mbox
- Create new mailbox.
- append [-time datetime] [-flag flag] mailbox file
- Read an RFC-822 message from file and append it to the mailbox. Use the -time option to supply envelope date for the message. Use -flag option to supply message flags. For example:
append -time "25-Aug-2002 18:00:00 +0200" -flag \Seen INBOX input.msg
- list ref mbox
- List matching mailboxes. See RFC 3501, section 6.3.8, for a discussion of its arguments.
- lsub ref mbox
- List subscribed mailboxes (RFC 3501, section 6.3.9).
- subscribe mbox
- Subscribe to a mailbox.
- unsubscribe mbox
- Remove mailbox mbox from the subscription list.
- Same as logout.
- Send a no operation.
- Close existing connection.
The imap shell implements the same set of internal commands as pop shell (see the description above). There is only one imap-specific internal command:
- uid [on|off]
- Control UID mode. When the UID mode is on, the commands fetch and store (and, in future, search and copy) operate on and return message UIDs instead of their sequence numbers.
- To examine the current state of the UID mode, issue the uid command without arguments.