Part of the bos.mh lpp (MH == mail handler). They are more functional than using the mail command to manage email.
You can do inc:
Incorporating new mail into inbox...
7+ 05/25 To:mksysb-alarm@p MKSYSB ERRORS - 2 <<Got some mksysb errors today.
8 06/05 To:mksysb-alarm@p MKSYSB ERRORS - 1 <<Got some mksysb errors today.
9 06/12 To:mksysb-alarm@p MKSYSB ERRORS - 1 <<Got some mksysb errors today.
The email will be moved from /var/spool/mail/USER into ~USER/Mail/inbox, one file per e-mail. The '+' sign marks the current email.
Scan the emails in inbox (scan or scan 6-8 to scan emails 1 through 8)
6 05/05 To:mksysb-alarm@p MKSYSB ERRORS - 1 <<Got some mksysb errors today.
7+ 05/25 To:mksysb-alarm@p MKSYSB ERRORS - 2 <<Got some mksysb errors today.
8 06/05 To:mksysb-alarm@p MKSYSB ERRORS - 1 <<Got some mksysb errors today.
Show an email (show to show current email or show 8 to show email 8 or show 6-8 to show emails 6-8)
This will also change the current mark (+) to the latest shown email.
Delete an email (rmm to delete the current email or rmm 8 to delete email 8 or rmm 6-8 to delete emails 6-8)
Show the next email (next - move current to the next email and show it) or previous (prev)
Move mails to another folder: refile 1-12 +backup
Use the pick command to list the email numbers for the refile command: refile $(pick -search "run-backup") +backup
Or to delete garbage: rmm $(pick -search "MakeMoneyFast")
This allows you to keep mails related to auditing and to drop operational fluff into the bitbucket.
sortm to sort messages (useful if you moved files with multiple iterations of the pick command), it also packs the numbering of the messages.
Ref: https://www.ibm.com/docs/en/aix/7.2?topic=programs-message-handler-mh
------------------------------
José Pina Coelho
IT Specialist at Kyndryl
------------------------------
Original Message:
Sent: Fri June 24, 2022 11:43 AM
From: Sylvain
Subject: purge mail older than x days
Hello,
What are inc, scan and rmm ?
Mail subcommands, tools … ?
Original Message:
Sent: 6/24/2022 11:01:00 AM
From: José Pina Coelho
Subject: RE: purge mail older than x days
Don't try to manage the mail directly.
Instead use "inc" to pull the mail into your home directory, then "scan" to list it, "show" to show specifc emails, and "rmm" to remove specific emails.
------------------------------
José Pina Coelho
IT Specialist at Kyndryl
Original Message:
Sent: Fri June 10, 2022 05:25 AM
From: Sylvain
Subject: purge mail older than x days
Hi all,
how can I purge mail older than x days on AIX ?
I want to schedule this kind of task via crontab.
Thanks in advance for your help.
------------------------------
Sylvain
------------------------------