We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

How to count unread messages from bash script?

  • 6 답장
  • 1 이 문제를 만남
  • 17 보기
  • 최종 답변자: wognatn

more options

Hello,

I would like to write a bash script to count new, unread emails, to show in conky. Apparently in the past,

grep -c "X-Mozilla-Status: 0000" /path/to/INBOX

worked, but no longer: INBOX file does not change when a new message is read. The corresponding INBOX.msf does, but the changes are pretty incomprehensible. Is there an unread message tag there that I could grep?

Or is there another way to find number of unread messages?

Thanks in advance.

MXLinux 17.1, Thunderbird 60.3.1

Hello, I would like to write a bash script to count new, unread emails, to show in conky. Apparently in the past, grep -c "X-Mozilla-Status: 0000" /path/to/INBOX worked, but no longer: INBOX file does not change when a new message is read. The corresponding INBOX.msf does, but the changes are pretty incomprehensible. Is there an unread message tag there that I could grep? Or is there another way to find number of unread messages? Thanks in advance. MXLinux 17.1, Thunderbird 60.3.1

글쓴이 wognatn 수정일시

모든 댓글 (6)

more options

If the account is IMAP and the account setting are not to store messages on this machine then there is no inbox file.

MSF files are in MORK format and ostensibly can be read with a script, but the effort would be significantly more that an unread email count is worth I would think.

more options

Matt said

the effort [to read msf file] would be significantly more that an unread email count is worth I would think.
Thanks, Matt. A little reading on MORK format convinces me you're right.
more options

wognatn said

Matt said
the effort [to read msf file] would be significantly more that an unread email count is worth I would think.
Thanks, Matt. A little reading on MORK format convinces me you're right.

MORK is also the format of the address book files That was my conclusion when I tried to extract information from them.

more options

I have a working check for new messages. As predicted, it was more effort than it was worth. In the unlikely event that anyone is interested ;) I'd welcome improvements and corrections.

It seems that unread messages result in a tag (^94=1) near the end of INBOX.msf. When any new message in that inbox is read or previewed, (^94=0) is appended. So the following works for me to check for new messages:

[loop over all accounts] tac /path/to/INBOX.msf | grep -m 1 '(^94=.)' | grep -v '(^94=0)' && [new mail action]

글쓴이 wognatn 수정일시

more options

This is useful.

Any pointers to articles on how to make this part of my local setup (I'm on Win 10...) It would be a bit of a hack to get Msys2 + minnty etc to do all that.

I'm yet to dive into scripting/macros/aliasing (etc) for Thunderbird

more options

I found no documentation, it's all trial and error based on Matt's answer above. There's a little more detail here.