Can I take mail from Maildir mailbox and deliver it as new?
Hello list, I have a need for someone to point me in the right direction.
Our old email system (system A) had an account that acted as a mailing list accumulator/archiver. This account was a member of every list and mail would be sent to it's address. The strange part is that email was not delivered to system A because there was a . (dot) forward alias to another machine (system B) that runs sendmail. System B's sendmail then slurped up the incoming mail and processed it in some fashion which I do not care about.
On our new mail server (system C (OS is RHEL6.5, dovecot-2.0.9-7.el6_5.1.x86_64, postfix-2.6.6-6.el6_5.x86_64)), I performed a bulk Linux account and mailbox migration from system A to system C using postfix/dovecot/imapsync. But I forgot to put the alias in place on system C to send all incoming that special account's mail on system B. So mail started to get delivered to local user ar_list on system C.
So now I have a Maildir format mailbox on system C that has mail in it and I want to be able to manipulate and/or re-send those emails as new mail to system B. Once it is received by sendmail on system B, then I don't care about it any more.
Is there a way to take mail sitting on disk in a mailbox and deliver it as if it was new mail to some other machine? Thanks, James
-bash-4.1$ ls -l total 566 drwx------ 2 ar_list users 2048 Aug 7 21:29 cur -rw------- 1 ar_list users 12556 Oct 8 17:09 dovecot.index -rw------- 1 ar_list users 378880 Oct 9 14:41 dovecot.index.cache -rw------- 1 ar_list users 2580 Oct 9 14:41 dovecot.index.log -rw------- 1 ar_list users 65549 Oct 9 14:41 dovecot-uidlist -rw------- 1 ar_list users 8 Aug 7 19:38 dovecot-uidvalidity -r--r--r-- 1 ar_list users 0 Aug 7 19:38 dovecot-uidvalidity.53e40ddc drwx------ 2 ar_list users 100352 Oct 9 14:41 new drwx------ 2 ar_list users 2048 Oct 9 14:41 tmp
-bash-4.1$ ls new/ | wc -l 1020
-bash-4.1$ ls cur | wc -l 25
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 4 Nov 2014, James Pryor wrote:
Is there a way to take mail sitting on disk in a mailbox and deliver it as if it was new mail to some other machine?
If you don't care about the Recieved and probable Delivered-To lines the delivery on system C has added, you can "resent" it via:
for f in new/* cur/*; do sendmail "final_recipient_on_system_B" < "$f" done
However, first test if a message sent from command line takes the route you want it to take :-)
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBVFnIQ3z1H7kL/d9rAQJX/AgAwyooFEWpVbc5g2mjcgSGnTgRQrnIlnag v0Hxr0ZHunYCQc9mXhGEOPsr3zCPEUxANDWf03H1jvUFxj37iCAp0X6MpMk13+x0 2U8pFx4bqEy82+71gh8r/UB/9KPUsgG32WLcE8xKqF8avtr4yJBazOScmtnbF/f/ cPzIFxf90eP/8VAlh3epRR1bwLVxnm1f+V0PqYry9zJ+ruVUL0DoJJiYOYxUg4Mz 684NDhz2DA8eDcf+Edrfy+UiRROR85idBWnj173lO0KL/K6bsyzfHtkqfaXgObO7 BjZdMelKTrVTTXmjSZaO0fOtbgQ6irZU5B1IxCbMAN12/l4RMFlxLw== =O7Rc -----END PGP SIGNATURE-----
Am 2014-11-04 um 23:12 schrieb James Pryor:
Is there a way to take mail sitting on disk in a mailbox and deliver it as if it was new mail to some other machine?
There is a one liner command in this fairly detailed HOWTO on refiltering mail:
https://mebsd.com/configure-freebsd-servers/dovecot-pigeonhole-sieve-filter-...
You just have to create the sieve that redirects anything.
-- peter
Thank you Dave, Peter, & Steffen for the replies. I will try the methods you mentioned and will post a follow up later. Thanks, James
On 11/05/2014 05:10 AM, Peter Chiochetti wrote:
Am 2014-11-04 um 23:12 schrieb James Pryor:
Is there a way to take mail sitting on disk in a mailbox and deliver it as if it was new mail to some other machine?
There is a one liner command in this fairly detailed HOWTO on refiltering mail:
https://mebsd.com/configure-freebsd-servers/dovecot-pigeonhole-sieve-filter-...
You just have to create the sieve that redirects anything.
-- James Pryor - pryor@bnl.gov RHIC/USATLAS Computing Facility Brookhaven National Laboratory Physics Dept. - Bldg. 510M Upton, New York 11973 Tel. : +1 (631) 344 2288 Fax. : +1 (631) 344 7616 https://www.racf.bnl.gov
participants (3)
-
James Pryor
-
Peter Chiochetti
-
Steffen Kaiser