You are not logged in.

#1 2009-03-09 12:21:12

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Purge Mail with Cron

Hi,
how can i purge mail from a specified folder via cron (which is the command, i know how to cronning the event big_smile ) ?
Thanks

Offline

#2 2009-03-11 03:26:57

pinchyfingers
Member
From: Bristol, PA
Registered: 2008-11-04
Posts: 46
Website

Re: Purge Mail with Cron

I don't know, 'rm $PATH/*' ?

I use IMAP and I have a single user system, so I don't know much about how mail works.

Offline

#3 2009-03-11 05:31:35

windowbreaker
Member
Registered: 2008-06-18
Posts: 46

Re: Purge Mail with Cron

Is this a Maildir folder?

Offline

#4 2009-03-11 05:56:48

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: Purge Mail with Cron

it's a mail folder but i don't want to delete ALL messages, i want only to delete the messages marked as deletables...

Offline

#5 2009-03-11 15:10:44

windowbreaker
Member
Registered: 2008-06-18
Posts: 46

Re: Purge Mail with Cron

Cagnulein wrote:

it's a mail folder but i don't want to delete ALL messages, i want only to delete the messages marked as deletables...

Define EXACTLY what you mean by "marked as deletables"?

Are you using an MUA like mutt/pine to "mark" them?  Please explain.

Offline

#6 2009-03-11 15:16:40

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: Purge Mail with Cron

yeah i'm using mutt.
For "marked as deletables" i mean the action of the hotkey 'd' in mutt.
And for purge i mean the action that mutt does when i close it
Thanks

Offline

#7 2009-03-11 15:42:46

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Purge Mail with Cron

deleting in mutt would mv the message to your defined trash folder, usually ~/Mail/Trash.  deleting from your trash folder within mutt would delete them forever, and is identical to rm ~/Mail/Trash/{new,cur,tmp}/* from CLI.  so if that's what you mean, that's how to cron it.  but it all depends on how your Maildir is set up and what hotkey you've defined... explore your Maildir, see where the messages go then put the rm command in cron.  right?

Last edited by brisbin33 (2009-03-11 15:45:14)

Offline

#8 2009-03-11 16:45:21

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: Purge Mail with Cron

Understood, thanks smile

Offline

#9 2009-03-11 19:42:44

windowbreaker
Member
Registered: 2008-06-18
Posts: 46

Re: Purge Mail with Cron

As brisbin33 stated, deleting it in mutt should delete the email file on your filesystem.  When you first hit 'd' Mutt marks it as deleted with a capital D in the index view.  To delete them while in mutt, hit the '$' key to sync up the mailbox, and all the msgs marked with a 'D' will go away - no need to cron or rm anything.

Offline

#10 2009-03-12 11:44:56

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: Purge Mail with Cron

I exlpain the situation:
I've got a IMAP server on my pc and i'm using mutt, thunderbird, squirrelmail and my nokia 6600 as clients.
I haven't a flat on my nokia6600, so when i download the email i would use less data as possible. So it's useless that my cellphone downloads mails flagged as deletable.
This is why I would like to do a little script that delete fisically the emails every minutes.

Offline

#11 2009-03-12 15:20:50

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Purge Mail with Cron

this sounds like a config option on your IMAP server.  you could cron an rm command on your Maildir's trash folder, or you could set it up so when you delete a message it's not retained in a trash folder at all.  either way, it's not really a client side activity in my opinion.

i think we're getting wrapped around the axle here on "flagged as deletable".  b/c in mutt you can "flag a message for deletion" in which case only when you sync your mailbox (press $, change folder, or exit) is that message a) moved to your defined trash folder in your clients configuration or b) deleted entirely.  it sounds like you want it gone forever no matter what, so just don't use a trash folder on your IMAP server and *actually* delete the messages when you delete the messages.  does that make sense?

Offline

#12 2009-03-12 19:33:10

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: Purge Mail with Cron

yes, i've undestood. I've already solve the problem autopurging the inbox when i close thunderbird (mutt already does this).
Thanks smile

Offline

Board footer

Powered by FluxBB