0

I would like to get the last email of an email file.

I found question that splits emails: How to split mailbox into single file per message?

But I would like something more efficient.

Ideally, I would like to get the message id of the last email. For one email, one can simply do:

formail -czxMessage-ID:
Community
  • 1
  • 1
Xu Wang
  • 10,199
  • 6
  • 44
  • 78

1 Answers1

1

You can do it like this:

formail -s formail -czx Message-Id: <mailbox | tail -1

This is probably not very efficient. However, more efficient methods are likely to be a lot more complicated.

Sato Katsura
  • 3,066
  • 15
  • 21