?
Solved

Bash script to delete emails

Posted on 2011-09-15
4
Medium Priority
?
342 Views
Last Modified: 2012-05-12
Hello

i need a script to delete emails from severals user accounts using criteria as number of messages or date (Ex. i need to launch a command and it to generate the deletion of emails from account1, account2, account3 that are older than 1st of september 2011)
Anyone can help?

Thank you in advance,
Cosmin
0
Comment
Question by:Cosmin Curticapean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36543856
Where do these mailboxes reside?  What client program are your users using for their mail?
0
 

Author Comment

by:Cosmin Curticapean
ID: 36547746
I have linux/sendmail as mail server, using a local file for each mailbox. As client usually i use MS Outlook, but also Squirrel Webmail. The problem is that i have some users that don't cleanup their email box and i end up with old messages on the server that are useless. I know about the settings in Outlook to delete old messages, also to delete emails from webmail but i need a tool i can use directly from the server to parse each specified mailbox and cleanup messages. This has to be as automated as possible (cron).
0
 
LVL 19

Accepted Solution

by:
xterm earned 500 total points
ID: 36581475
This little script is awesome:  http://freshmeat.net/projects/mboxpurge/

Just do:

BOXES="account1 account2 account3"
for MBOX in `echo $BOXES`;
do
  mboxpurge.pl -m 2011-09-01 $MBOX
done

If you want do all the mailboxes in /var/spool/mail, just replace the "for" line above with:

for MBOX in `ls /var/spool/mail`;
0
 

Author Comment

by:Cosmin Curticapean
ID: 36597874
Hello

it works, i did the test just by running a command line with the following content:
perl mboxpurge.pl -m 2011-09-01 /usr/mail/***

Thank you,
Cosmin C.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question