How to automatically move messages between Maildir folders?

How to automatically move messages between Maildir folders?

am 08.07.2006 14:39:48 von david

Hi,

I'm trying to work out the best way to automatically move messages from
one Maildir folder to another.

The scenario is that we have a global address ("info@.....") that a
human reads through and transfers the emails to the most appropriate
person. We used to do this by simply forwarding the emails but this
isn't really working as the end recipient in our organisation just ends
up with many messages all seemingly from the same person, which can't be
easily replied to (because they've been forwarded).

So we set up shared IMAP folders so that the messages could be "moved"
(drag & drop) into the correct shared folder (for a specific user) so
that all the headers, etc. are retained and we avoided the need to
forward stuff. This works at a technical level but now our users want
messages from their shared folder automatically moved to their inbox
and this is where I'm getting stuck.

I thought a simple procmail recipe would work but there seem to be two
problems: the first is that procmail isn't invoked when messages are
moved between IMAP folders, and the second is there doesn't appear to be
a way to write a procmail recipe to test if the message is already in a
particular (shared) folder to determine if it should be moved to the
inbox folder.

We did briefly toy with the idea of setting up the incoming email client
(the one that reads the all messages to decide what to do with them)
with all the other users IMAP accounts so that they could just move the
messages directly into each users inbox - and whilst this does exactly
what we want, it has the unacceptable side-effect of giving that person
access to everyone's inbox! but I think this does give the idea of what
we are trying to do.

This must be a pretty generic requirement in many organisations but I've
Googled and come up with very little.

Does any one have any thoughts, pointers that might help?

Many thanks, David

Re: How to automatically move messages between Maildir folders?

am 08.07.2006 15:20:20 von Sam

This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.

--=_mimegpg-commodore.email-scan.com-6642-1152364818-0005
Content-Type: text/plain; format=flowed; charset="US-ASCII"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

David writes:


> We did briefly toy with the idea of setting up the incoming email client
> (the one that reads the all messages to decide what to do with them)
> with all the other users IMAP accounts so that they could just move the
> messages directly into each users inbox - and whilst this does exactly
> what we want, it has the unacceptable side-effect of giving that person
> access to everyone's inbox! but I think this does give the idea of what
> we are trying to do.
>
> This must be a pretty generic requirement in many organisations but I've
> Googled and come up with very little.
>
> Does any one have any thoughts, pointers that might help?

Messages in maildirs are just ordinary files.

Write a shell script to go through each file in the maildir, and move it
whereever you want it.



--=_mimegpg-commodore.email-scan.com-6642-1152364818-0005
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)

iD8DBQBEr7ESx9p3GYHlUOIRAmLIAJ934QY54ba/QEQi/zsR7EwrgOlChwCf UESP
bTURJ3AvOduhXxR/PoBKxPs=
=rdOZ
-----END PGP SIGNATURE-----

--=_mimegpg-commodore.email-scan.com-6642-1152364818-0005--

Re: How to automatically move messages between Maildir folders?

am 09.07.2006 00:38:37 von david

Sam wrote:
>
> Messages in maildirs are just ordinary files.
>
> Write a shell script to go through each file in the maildir, and move it
> whereever you want it.
>
>
Thanks Sam, works great.

David.

Re: How to automatically move messages between Maildir folders?

am 10.07.2006 14:00:21 von david

Sam wrote:
> Messages in maildirs are just ordinary files.
>
> Write a shell script to go through each file in the maildir, and move it
> whereever you want it.
>
>
Ah, spoke too soon - the messages are now getting to the correct place,
so I'm on the right lines, but hey appear to read messages (because
someone has indeed read the message inorder to decide who should deal
with it). I can see that this is indicated by the final "S" in the
filename but what I can't figure out is how to automate renaming the
filename to remove that final "S" as there are other "S"s in the
filename with the same preceeding character ("," as it happens)?

Does anyone know who to write a script that renames a file by dropping
the *last* "S" from it, if it has one?

Thanks, David

Re: How to automatically move messages between Maildir folders?

am 11.07.2006 00:28:53 von Sam

This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.

--=_mimegpg-commodore.email-scan.com-22392-1152570533-0002
Content-Type: text/plain; format=flowed; charset="US-ASCII"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

David writes:

> Does anyone know who to write a script that renames a file by dropping
> the *last* "S" from it, if it has one?

This is now purely a shell-scripting excersize, try comp.unix.shells. But
I'll give you something to use as a starting point:

sed 's/\(.*\):2,\([^\/]*\)S\([^\/]*\)/\1:2,\2\3/'

But, if I were to do something like this, I'd do everything in Perl.



--=_mimegpg-commodore.email-scan.com-22392-1152570533-0002
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)

iD8DBQBEstSlx9p3GYHlUOIRArXvAJ9B9psK/2cOtdqlRN+skH6IQGNu8wCd HJrF
iLKw52odDJrS9MPvpR9+vhY=
=I8K3
-----END PGP SIGNATURE-----

--=_mimegpg-commodore.email-scan.com-22392-1152570533-0002--

Re: How to automatically move messages between Maildir folders?

am 23.07.2006 19:21:28 von gtaylor

Sam wrote:
> Messages in maildirs are just ordinary files.
>
> Write a shell script to go through each file in the maildir, and move it
> whereever you want it.

*nod* As Sam said you can move messages between MailDir as files with out a problem. Continue using shared IMAP folders. However make sure you have a shared IMAP folder for EACH of your recipients. Then set up a cron script to move messages out of the Shared IMAP MailDirs in to the corresponding recipient's Inbox MailDir. This will allow you to have users move messages to the correct recipient via shared IMAP folders which will then be moved to the correct inbox auto-magically.



Grant. . . .