System Administration
Showing results for 
Search instead for 
Did you mean: 

Removing mails more than 1 day

Henry Chua
Super Advisor

Removing mails more than 1 day

Hi guys,

I am using sendmails in my box, is there a way to remove mails more than a specified period of time? Thanks.

Best regards
Steven E. Protter
Exalted Contributor

Re: Removing mails more than 1 day

Shalom Henry,

That depends how you store them. If they are sitting in a file in /var/spool/mail raw, its difficult. You'd need to write a script to edit that file.

Need to know a little more about how the mail is stored to assist you.

Steven E Protter
Owner of ISN Corporation
Ivan Ferreira
Honored Contributor

Re: Removing mails more than 1 day

The important thing here is which MTA are you using (qmail, sendmail, postfix, exim, etc).

See this page:
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Emir Faisal
Frequent Advisor

Re: Removing mails more than 1 day

...or you might want to change your sendmail behavior by set the Timeout.queuereturn to 1 day in your or This behavior will send bounced message to sender if the message stay in the queue after 1 day.

dnl define('confTO_QUEUERETURN', '1d')dnl
then run m4 macro to regenerate and put it in the right location (/etc/ ?).

O Timeout.queuereturn=1d

either way, don't forget to restart sendmail daemon.

Everything is possible, if you don't know what you're talking about.