Unix/Linux Go Back    


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 !!

How to delete all email messages at ONE time?

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-13-2006
bobo bobo is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 9 April 2015, 3:28 PM EDT
Posts: 161
Thanks: 1
Thanked 0 Times in 0 Posts
Data 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 Unix and Linux 07-13-2006
yamiear yamiear is offline
Registered User
 
Join Date: Feb 2006
Last Activity: 20 July 2006, 2:53 PM EDT
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 Unix and Linux 07-13-2006
bobo bobo is offline
Registered User
 
Join Date: Jan 2006
Last Activity: 9 April 2015, 3:28 PM EDT
Posts: 161
Thanks: 1
Thanked 0 Times in 0 Posts
Data 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 Unix and Linux 07-13-2006
yamiear yamiear is offline
Registered User
 
Join Date: Feb 2006
Last Activity: 20 July 2006, 2:53 PM EDT
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 Unix and Linux 07-14-2006
blowtorch's Unix or Linux Image
blowtorch blowtorch is offline Forum Advisor  
AFK
 
Join Date: Dec 2004
Last Activity: 16 April 2015, 11:34 AM EDT
Location: UK
Posts: 2,351
Thanks: 0
Thanked 6 Times in 6 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 Unix and Linux 07-14-2006
reborg's Unix or Linux Image
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 11 Times in 11 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
1000s of undelivered email messages timgolding Security 1 10-29-2010 03:14 PM
Delete email recd suismilyadon Solaris 2 09-24-2009 04:15 AM
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



All times are GMT -4. The time now is 08:37 AM.