Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mail.imap

import mail

Everything here is re-exported by mail, so import mail is enough and the names are called as mail.*. Importing mail.imap on its own works too and reaches the same definitions.

IMAP: reading mail where it is kept, rather than taking it away.

Both ends are here. ImapClient talks to a server; ImapServer is one, answering out of a MailStore of which two ship.

import mail.imap { ImapClient }

var inbox = ImapClient.connect('imaps://mail.example.com', {
  username: 'ann',
  password: secret,
})

inbox.select('INBOX')

echo inbox.search('UNSEEN', true).length()

inbox.logout()

Submodules

ModuleReached asSummary
mail.imap.clientmail.*The reading end of IMAP.
mail.imap.parserimport mail.imap.parserThe IMAP grammar: turning what a server says into something a program can read.
mail.imap.servermail.*The serving end of IMAP.
mail.imap.storemail.*Where an ImapServer keeps mail.

2026, Richard Ore and Zuri contributors