Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Search Forums:



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-13-2006
Registered User
 

Join Date: Jan 2006
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy How to delete all email messages at ONE time?

These are some of the mail command:

Usage:
? print this help message
# display message number #
- print previous
+ next (no delete)
! cmd execute cmd
<CR> next (no delete)
a position at and read newly arrived mail
d [#] delete message # (default current message)
dp delete current message and print the next
dq delete current message and exit
h a display all headers
h d display headers of letters scheduled for deletion
h [#] display headers around # (default current message)
m user mail (and delete) current message to user
n next (no delete)
p print (override any warnings of binary content)
P override default 'brief' mode and display ALL header lines
q, ^D quit
r [args] reply to (and delete) current letter via mail [args]
s [files] save (and delete) current message (default mbox)
u [#] undelete message # (default current message)
w [files] save (and delete) current message without header
x exit without changing mail
y [files] save (and delete) current message (default mbox)


Is there 1 command to delete all your email?

THANKS!
Sponsored Links
    #2  
Old 07-13-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
deleting mail in Unix

type mail

d * will remove all mail

d 1 3 deletes the 1st and 3rd messages
d 1-3 deletes messages 1 through 3
d * deletes all your messages
d deletes the current message
The Following User Says Thank You to yamiear For This Useful Post:
ngaisteve1 (08-12-2010)
Sponsored Links
    #3  
Old 07-13-2006
Registered User
 

Join Date: Jan 2006
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy still have problems!!!!

type in mail
then
? d *
Illegal numeric
?


or

? d 1-3
Illegal numeric
?


These are messages that I got!!!

Please let me know what is wrong!
    #4  
Old 07-13-2006
Registered User
 

Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Not sure

Works on AIX 5.2

Mail [5.2 UCB] [AIX 5.X] Type ? for help.
"/var/spool/mail/maestro": 2 messages 2 new
>N 1 MAILER-DAEMON Tue Jul 11 20:29 83/2771 "Warning: could not send mess"
N 2 MAILER-DAEMON Wed Jul 12 00:29 83/2773 "Warning: could not send mess"

? d *
? quit
(maestro@)/usr/local/tivoli/maestro>mail
No mail for maestro
Sponsored Links
    #5  
Old 07-14-2006
blowtorch's Avatar
AFK
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,351
Thanks: 0
Thanked 2 Times in 2 Posts
I think that deleting all messages can be done by truncating the /var/mail/<userid> files as well. But not sure if that will have any unwanted side effects.
Sponsored Links
    #6  
Old 07-14-2006
reborg's Avatar
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,466
Thanks: 0
Thanked 6 Times in 6 Posts
It can be done by truncating the mail spool for the user

if you have mailx

try delete *


Code:
#! /usr/bin/ksh
#
# delete_mails.ksh
# 

#
# You may want a confirmation dialog here, delete can't be reversed.
#

MAIL=$(mail << EOF | sed -n 's/^[>    ][      ]*\([0-9][0-9]*\)[      ][      ]*.*/\1/p'
h a
EOF
)
mail |&
for mail in $MAIL; do
    print -p d $mail
print q

sleep 1
exit 0

** note do not just copy and paste the code.
each
Code:
  [        ]

is a [ followed by a space and a tab followed by a ].

Last edited by reborg; 06-12-2007 at 04:51 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to delete old email addresses? Deede UNIX for Dummies Questions & Answers 1 02-03-2004 03:25 PM
How to delete email addresses Deede Programming 4 02-02-2004 06:23 PM
Delete All email foothillnet UNIX for Dummies Questions & Answers 2 07-21-2003 03:48 PM
How do we delete spam email on mmdf esh UNIX for Dummies Questions & Answers 2 06-09-2003 09:48 AM



All times are GMT -4. The time now is 03:48 AM.