Repository navigation
2.3.0: Body reads from disk and paged scans
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 readandshowtake the body from Mail.app's message file on disk and ask Mail.app only for metadata. Each result hascontentSource, which isdiskormail. A message with no readable file falls back to Mail.app, and--body-source mailmakes Mail.app render the body as before.messages readitems carrydiagnosticswith the time spent in each phase of the read. When a read times out,pendingnames the operation Mail.app had not answered andlastCompletednames the one before it.messages scantakes--cursorand returnsnextCursor. To read a mailbox to the end, repeat the same arguments with--cursor "$NEXT_CURSOR"until a result has nonextCursor. Pages run newest first, and each coverage entry reportsexhaustedandremaining. A cursor works only with the mailboxes and filters it was issued for, though--limitcan change between pages.- Verified archive and move receipts carry
observedwithsourcePresent,destinationPresent,destinationRead, and the message's current local IDs insourceIdsanddestinationIds. When Mail.app regenerates a Gmail message in INBOX after an archive,verifyStatusstayspresent_in_sourceandsourceIdsholds 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-contentstill asks Mail.app to render each body, so it can still stall. Read bodies withmessages readorshow.
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:noneand>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 mailto get Mail.app's text. message not foundnow means Mail.app answered and the mailbox does not hold the ID. A Mail.app error duringreadorshowused 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 --queryused to stop at 50 results per mailbox and still reportcomplete: true. Scan now applies--queryand--unreadbefore--limitand returns every match, one page at a time. A mailbox with more matches than--limitsetscomplete: false, exits 5, and returns anextCursorto continue.
For direct Go installation, use:
go install github.com/0xSMW/mail.app-cli/v2/cmd/mail-app-cli@latest