Skip to content

2.3.0: Body reads from disk and paged scans

Choose a tag to compare

@0xSMW 0xSMW released this 29 Sep 11:38
· 707 commits to master since this release
20ff3a2

mail-app-cli 2.3 reads message bodies from the files Mail.app keeps on disk, so read and show no longer wait for Mail.app to render a body. A message that used to stall Mail.app no longer holds up the commands queued behind it. messages scan can now page through a mailbox of any size with a cursor, and verified archives and moves report what they found in the source and the destination. A few outputs change in ways a script can notice. They are listed under "Changes that can affect scripts".

Summary

  • messages read and show take the body from Mail.app's message file on disk and ask Mail.app only for metadata. Each result has contentSource, which is disk or mail. A message with no readable file falls back to Mail.app, and --body-source mail makes Mail.app render the body as before.
  • messages read items carry diagnostics with the time spent in each phase of the read. When a read times out, pending names the operation Mail.app had not answered and lastCompleted names the one before it.
  • messages scan takes --cursor and returns nextCursor. To read a mailbox to the end, repeat the same arguments with --cursor "$NEXT_CURSOR" until a result has no nextCursor. Pages run newest first, and each coverage entry reports exhausted and remaining. A cursor works only with the mailboxes and filters it was issued for, though --limit can change between pages.
  • Verified archive and move receipts carry observed with sourcePresent, destinationPresent, destinationRead, and the message's current local IDs in sourceIds and destinationIds. When Mail.app regenerates a Gmail message in INBOX after an archive, verifyStatus stays present_in_source and sourceIds holds the new ID to act on.
  • Mailbox lookup reads each level of the mailbox tree from Mail.app in one request instead of one mailbox at a time. Every command that resolves a mailbox through Mail.app is faster, mutations included.
  • list --with-content still asks Mail.app to render each body, so it can still stall. Read bodies with messages read or show.

Changes that can affect scripts

  • Body text read from disk can differ slightly from Mail.app's rendering. It uses the HTML part when there is one, drops elements styled display:none and > reply markers, keeps list markers, and leaves out the placeholder character Mail.app inserts for each inline image. It applies inline styles only, so spacing can differ where a stylesheet sets the layout. Pass --body-source mail to get Mail.app's text.
  • message not found now means Mail.app answered and the mailbox does not hold the ID. A Mail.app error during read or show used to be reported as not found. It now returns an error that names the phase where it happened.
  • A mailbox lookup that times out or loses its connection to Mail.app now reports that failure. It used to report the mailbox as missing.
  • messages scan --query used to stop at 50 results per mailbox and still report complete: true. Scan now applies --query and --unread before --limit and returns every match, one page at a time. A mailbox with more matches than --limit sets complete: false, exits 5, and returns a nextCursor to continue.

For direct Go installation, use:

go install github.com/0xSMW/mail.app-cli/v2/cmd/mail-app-cli@latest