LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mailx listing users with unread mail! (https://www.linuxquestions.org/questions/linux-newbie-8/mailx-listing-users-with-unread-mail-4175618970/)

goofygoober 12-04-2017 06:14 PM

mailx listing users with unread mail!
 
Hello there, I'm itching for some help with figuring out how to list the users in /var/spool/mail/ directory that have unread mail.
How would this even be possible considering I do not have access to other user's mail list?

Thanks for any help!

!j* 12-04-2017 07:49 PM

mailx listing users with unread mail!
 
Try: lsmbox (or look into its source code)

AwesomeMachine 12-05-2017 11:54 PM

The unread flag is either set or clear. You can write a script to plow through each users email until it finds a set 'unread' flag, make note of the user, and continue on until every user's status as you define it is determined.

You can write the names to a file one at a time as you go, or all at the end when you're done. But without access to the emails it might be tough.


All times are GMT -5. The time now is 02:18 AM.