Operating System - HP-UX
1833781 Members
2214 Online
110063 Solutions
New Discussion

Deleting mail from a specific user

 
Leslie Chaim
Regular Advisor

Deleting mail from a specific user

Before I start to write some regex sniffing perl...

Is there a standard to delete mail from /var/mail/...
from a specific user.

The from command has the -s option which lists mail from a specific user.

I am looking to delete mail from a specific user.

Here is what I have:
--------------------------
$ from | wc -l
328
$ from -s ops | wc -l
173
--------------------------

I would like to delete all mail from ops.
If life serves you lemons, make lemonade
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Deleting mail from a specific user

If you're deleting it all, just rm /var/mail/ops or cat /dev/null > /var/mail/ops.

Pete

Pete
Pete Randall
Outstanding Contributor

Re: Deleting mail from a specific user

Oops, I missed the "from" part. Working . . .

Pete

Pete
Jean-Louis Phelix
Honored Contributor

Re: Deleting mail from a specific user

hi,

Use :

mailx <<+++
delete ops
+++

regards,

Jean-Louis.
It works for me (© Bill McNAMARA ...)
Justo Exposito
Esteemed Contributor

Re: Deleting mail from a specific user

Hi Jean,

Good Answer!!

Do you know how to delete messages from a user between dates?

Regards,

Justo.
Help is a Beatiful word
Darrell Allen
Honored Contributor

Re: Deleting mail from a specific user

Hi Leslie,

I thought Jean-Louis's reply was very good. To expand on it for a specified receipent:

mailx -f /var/mail/username <<+++
delete ops
+++

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)