3

Here is the use case. From time to time I read messages contained in an MBOX file using mutt. For the sake of this question I'll use the following to create an MBOX file for reference:

curl -L 'https://github.com/torvalds/linux/compare/ce5c2d2c256a4c8b523036537cd6be2d6af8f69d%5E%5E...ce5c2d2c256a4c8b523036537cd6be2d6af8f69d.patch' > for_review.mbox

Now if I were to open this with mutt -f for_review.mbox I'm presented with about 104 emails. Each marked as new. Now at my convenience I can read each one. In fact I can pipe the emails to a syntax highlighter and/or open the patched file(s) in an editor to see how they relate.

When finished reading an email it is marked as read and I can quit at anytime. The next time I open the MBOX file it remembers my read/unread status. This is great for offline reviews of lots of changes.

The next best thing would be the option to reply to the emails with a personal note. However, I found that if I set the Fcc: field to the MOX file and blank out the To: field to prevent sending an actual email out into the internet that mutt complains about needing a recipient.

How do I send an email (new or reply) directly into an MBOX file without actually sending an email through an SMTP server?

1

A cumbersome workaround is to write your reply, then instead of sending the mail, postpone it (using P instead of y). Then open the postponed folder, select all messages, and tag-save them to your MBOX.

Note that, since your message was never actually sent, it is missing the message-ID, so mutt will not be able to resolve threads (i.e. your fake reply will not show as part of the original thread).

If you need, you can manually link your fake reply to a thread (by tagging your reply, and then pressing & on the original message). This will add the in-reply-to headers to your fake reply.

1

Two methods I can think of, both of which involve actually sending the message.

  1. Send the message to yourself and use a mail-filtering rule (e.g. a maildrop or procmail rule) to store the incoming message in your for_review.mbox mailbox).

  2. Send the message to a /dev/null alias, and use a folder-hook to set the Fcc to the for_review.mbox. For example, something like:

folder-hook for_review.mbox "set record=~/mail/for_review.mbox"

It's also possible that you could use a folder-hook to "set postponed=~/mail/for_review.mbox", and postpone the messages rather than save or send them but I have no idea how mutt will react if the postponed folder is the same as the current mailbox, or how it will handle apparently-saved messages that don't have a valid message-id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.