Die Funktionalität dieser Website ist durch Wartungsarbeiten eingeschränkt, die Ihr Erlebnis verbessern sollen. Wenn ein Artikel Ihr Problem nicht löst und Sie eine Frage stellen möchten, können Sie unsere Gemeinschaft über @FirefoxSupport auf Twitter, /r/firefox oder Reddit fragen.

Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Weitere Informationen

How to count unread messages from bash script?

  • 6 Antworten
  • 1 hat dieses Problem
  • 17 Aufrufe
  • Letzte Antwort von 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

Geändert am von wognatn

Alle Antworten (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]

Geändert am von 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.