The imap vocab implements a large part of the IMAP4rev1 client protocol.

IMAP is primarily used for retrieving and managing email and folders on an IMAP server. Note that some IMAP servers, such as imap.gmail.com, require application-specific passwords.

Configuration:
imap-settings


Combinators:
with-imap ( host email password quot -- )

with-imap-settings ( imap-settings quot -- )


Constructing an IMAP session:
<imap4ssl> ( host -- imap4 )


IMAP folder management:
list-folders ( directory -- folders )

select-folder ( mailbox -- count )

create-folder ( mailbox -- )

delete-folder ( mailbox -- )

rename-folder ( old-name new-name -- )

status-folder ( mailbox keys -- assoc )

close-folder ( -- )


Retrieving mails:
search-mails ( data-spec str -- uids )

fetch-mails ( uids data-spec -- texts )


Updating and storing mails:
copy-mails ( uids mailbox -- )

append-mail ( mailbox flags date-time mail -- uid/f )

store-mail ( uids command flags -- mail-flags )


Examples
USING: imap ; "imap.gmail.com" "email_address@gmail.com" "password" [ list-folders ] with-imap

USING: imap namespaces ; \ imap-settings get-global [ "factor" select-folder drop "ALL" "" search-mails "(BODY[HEADER.FIELDS (SUBJECT)])" fetch-mails ] with-imap-settings 3 head .
{ "Subject: [Factor-talk] Wiki Tutorial" "Subject: Re: [Factor-talk] font-size in listener" "Subject: Re: [Factor-talk] Indentation width and other style guidelines" }