using the mail utility

I'm using sendmail locally, and I'm trying to delete messages at the terminal with mail(1). From the manual:

Code:
   delete  (d) Takes a list of messages as argument and marks them all as
	     deleted.  Deleted messages will not be saved in mbox, nor will
	     they be available for most other commands.

Could someone give me an example?

I've tried

[CMD="&"]delete 4[/CMD]
[CMD="&"]d 4[/CMD]

But this doesn't remove message number four?


help
 
DutchDaemon said:
It depends on whether you quit with 'q' or 'x' ..

Hi and thankyou.

If I quit with 'q' the shell prints:

Code:
& q
Held 18 messages in /var/mail/user

but

Code:
$ cd user
cd: user no such file or directory

I guess that's since:

Code:
-rw-------  1 user   wheel   48837 May 14 07:51 user
-rw-------  1 mysql  mysql       0 May  9 09:55 mysql
-rw-------  1 root   wheel  247549 May 10 13:16 root
-rw-------  1 user   1001        0 Jan 30 14:27 tqadmin

If I quit with 'x', then I'm returned to the shell OK. I still can't delete messages though?
 
Quick tutorial to get you started:
If you want to look messages saved in "user" mailbox:
$ mail -f /var/mail/user
And if you want to delete message number 4 of those:
[CMD="&"]d 4[/CMD]
To see all messages in mailbox:
[CMD="&"]h[/CMD]
To quit mail session
[CMD="&"]q[/CMD]
And more information google and
$ man mail

Happy mailing :)
 
Kiiski said:
Quick tutorial to get you started:

Thanks, but it's as clear as mud. Now, upon:

Code:
$ q
mail: /home/user/mbox: Permission denied

And still can't delete messages?

I'm not finding mail(1) helpful at all.
 
Kiiski said:
Quick tutorial to get you started:
If you want to look messages saved in "user" mailbox:
$ mail -f /var/mail/user
And if you want to delete message number 4 of those:
[CMD="&"]d 4[/CMD]

OK. If I $ mail -f /var/mail/user I'm taken through to my mailbox. If I then [CMD="&"]d 4[/CMD]

Message number 4 looks like:
Code:
 U  2 root@my.domain.or  Thu May 10 11:09  89/3248  "my.domain.com dail"
 U  3 spam@domain.  Thu May 10 13:18  44/1955  "test mail"
    4 test@somedomain.com  Thu May 10 13:25  47/2917  "test"

What's the definition of a deleted message? I thought it would be removed from the list...
 
I needed to su to root to delete messages. My mailbox is an alias of the root account, red-faced.

Thanks again for all your help.
 
Back
Top