imap via linux shell

Tagged as linux, imap, imaps, bash, openssl, nc

Written on 2016-11-09 23:52

Connect to server:

# IMAP
nc SERVERNAME-OR-IP 143
# IMAPS
openssl s_client -connect SERVERNAME-OR-IP:993

IMAP commands:

  • enumerate/prefix commands with arbitrary labels or simply a '.'
  • login USERNAME "PASSWORD" # login
  • list "" "*" # show all mailboxes
  • status [mailbox]
  • select "MAILBOX" # switch to mailbox
  • fetch FIRST:LAST FLAGS
  • fetch MAILID BODY[HEADER]
  • fetch MAILID BODY[TEXT]
  • uid search all
  • uid store MAILID +flags (\Deleted) # mark as deleted
  • expunge # actual delete
  • logout # logout

Unless otherwise credited all material Creative Commons License by sjas