Re: moving messages on imap4 server based on date received

2017-10-08 Thread tech-lists

On Sun, Oct 08, 2017 at 04:35:47PM -0500, Larry Rosenman wrote:

Whether you can run on YOUR server, I do not know, but I've been running 
this script for ~1 year.


Hi, thanks for the script, I've saved it as it may come in useful
one day. Unfortunately I'm not running my own mail server at this
time; I'm using FastMail so need to work around that.

archivemail *nearly* does what's needed, except that it saves to local
disk, whereas what I want is to save it in an archive folder on the
server, without compression or other encoding.

There's an add-on for Thunderbird that does exactly what's needed. It's
called awesome auto-archiver or something like that. Of course the
problem for me there is that it's thunderbird, and I want to run mutt
because it's elegant and lightweight and copes happily with thousands
of emails even on a low-powered netbook.

--
J.


Re: moving messages on imap4 server based on date received

2017-10-08 Thread Larry Rosenman
I use the following cron job on my server using doveadm running on the imap 
server:
lrosenman:~ lrosenman$ ssh tbh.lerctr.org cat bin/archive-mail
#!/bin/sh
PATH=$PATH:/usr/local/bin
#Expects to be run after midnight on the first of the month
#  to archive all the previous months mail
#Date Run:
TODAY=`date "+%Y-%m-%d"`
#last month in /MM
YEAR_LAST_MONTH=`date -v-1d "+%Y/%m"`
#1st of last month as 01-Mon-
FIRST_LAST_MONTH=`date -v-1d "+01-%b-%Y"`
echo 'TODAY=' ${TODAY}
echo 'YEAR_LAST_MONTH=' ${YEAR_LAST_MONTH}
echo 'FIRST_LAST_MONTH=' ${FIRST_LAST_MONTH}
# get a list of all the mailboxes with at least one real message
doveadm -f tab mailbox status vsize \* 2>/dev/null |
sed -e 1d | sort -k 1,1 |
awk  'BEGIN {FS="\t"} {if ($2 > 0)  print $1}' |
while read i
do
   echo `date` start ${i}
   doveadm mailbox create "ARCHIVE/${YEAR_LAST_MONTH}/${i}"
   doveadm -f tab mailbox status messages "${i}"
   doveadm move "ARCHIVE/${YEAR_LAST_MONTH}/${i}" mailbox \
"${i}" BEFORE ${TODAY} SINCE ${FIRST_LAST_MONTH}
   doveadm -f tab mailbox status messages "${i}"
   echo `date` done  ${i}
done
lrosenman:~ lrosenman$

Whether you can run on YOUR server, I do not know, but I've been running this 
script for ~1 year. 


-- 
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: l...@lerctr.org
US Mail: 5708 Sabbia Drive, Round Rock, TX 78665-2106
 
 
On 10/8/17, 4:10 PM, "tech-lists"  wrote:

On Thu, Sep 28, 2017 at 03:56:35PM -0400, Dan Ritter wrote:
>On Thu, Sep 28, 2017 at 02:10:22PM +0100, tech-lists wrote:
>> Hello mutt-users@
>>
>> I'm running mutt 1.9.1 (2017-09-22) on freebsd-11-stable.
>>
>> What I'd like to have is, when mutt loads, it scans its subscribed
>> folders and moves the mail based on date received into preconfigured
>> mail folders. Either that, or maybe run another standalone program in a
>> screen or cron that does the same. I don't want to "download" the mail
>> at this stage - it needs to be moved around on the remote server.
>>
>> Can mutt do this, or is there another program that does this with imap4?
>
>If your IMAP server supports SIEVE, that is the easiest way to
>get this done. Sorting will happen at delivery time.

Hi, sorry for the late reply

The reason I can't use SIEVE is because SIEVE rules act at delivery time
only. By delivery time, I mean the time they arrive on the imap server.

What I want to happen is, for emails already in folders on the imap
server, if they're over say 30 days old, for an automatic process to
move them into an archive folder on the same server.

thanks,
-- 
J.





Re: moving messages on imap4 server based on date received

2017-10-08 Thread tech-lists

On Thu, Sep 28, 2017 at 03:56:35PM -0400, Dan Ritter wrote:

On Thu, Sep 28, 2017 at 02:10:22PM +0100, tech-lists wrote:

Hello mutt-users@

I'm running mutt 1.9.1 (2017-09-22) on freebsd-11-stable.

What I'd like to have is, when mutt loads, it scans its subscribed
folders and moves the mail based on date received into preconfigured
mail folders. Either that, or maybe run another standalone program in a
screen or cron that does the same. I don't want to "download" the mail
at this stage - it needs to be moved around on the remote server.

Can mutt do this, or is there another program that does this with imap4?


If your IMAP server supports SIEVE, that is the easiest way to
get this done. Sorting will happen at delivery time.


Hi, sorry for the late reply

The reason I can't use SIEVE is because SIEVE rules act at delivery time
only. By delivery time, I mean the time they arrive on the imap server.

What I want to happen is, for emails already in folders on the imap
server, if they're over say 30 days old, for an automatic process to
move them into an archive folder on the same server.

thanks,
--
J.


Re: moving messages on imap4 server based on date received

2017-09-28 Thread tech-lists

On Thu, Sep 28, 2017 at 03:56:35PM -0400, Dan Ritter wrote:


If your IMAP server supports SIEVE, that is the easiest way to
get this done. Sorting will happen at delivery time.


yep it supports seive, but not every option, hopefully it will support
mive from folder by arrive date, for multiple folders.

thanks,
--
J.


Re: moving messages on imap4 server based on date received

2017-09-28 Thread Dan Ritter
On Thu, Sep 28, 2017 at 02:10:22PM +0100, tech-lists wrote:
> Hello mutt-users@
> 
> I'm running mutt 1.9.1 (2017-09-22) on freebsd-11-stable.
> 
> What I'd like to have is, when mutt loads, it scans its subscribed
> folders and moves the mail based on date received into preconfigured
> mail folders. Either that, or maybe run another standalone program in a
> screen or cron that does the same. I don't want to "download" the mail
> at this stage - it needs to be moved around on the remote server.
> 
> Can mutt do this, or is there another program that does this with imap4?

If your IMAP server supports SIEVE, that is the easiest way to
get this done. Sorting will happen at delivery time.

If your mail server supports procmail, mailfilter, or running
your own delivery programs via a .forward or equivalent, that
is also an easy way to get this done at delivery time.

-dsr-


moving messages on imap4 server based on date received

2017-09-28 Thread tech-lists

Hello mutt-users@

I'm running mutt 1.9.1 (2017-09-22) on freebsd-11-stable.

What I'd like to have is, when mutt loads, it scans its subscribed
folders and moves the mail based on date received into preconfigured
mail folders. Either that, or maybe run another standalone program in a
screen or cron that does the same. I don't want to "download" the mail
at this stage - it needs to be moved around on the remote server.

Can mutt do this, or is there another program that does this with imap4? 


thanks,
--
J.