IMAP

Reading Email

Curl

Get the number of emails in the inbox:

curl 'imap://10.10.10.17/INBOX?ALL' --user orestis:kHGuERB29DNiNE

Select an email to read:

curl 'imap://<IP>/INBOX;MAILINDEX=<#>' --user <username>:<password>

Example:

curl 'imap://10.10.10.17/INBOX;MAILINDEX=1' --user orestis:kHGuERB29DNiNE

Example Bash Loop:

for i in {1..5}; do
  curl "imap://10.10.10.17/INBOX;MAILINDEX=$i" --user orestis:kHGuERB29DNiNE | tee email-$i.txt

See if there are any draft emails:

curl 'imap://10.10.10.17/DRAFTS?TEXT' --user orestis:kHGuERB29DNiNE

Last updated

Was this helpful?