Procmail - Bounce a copy and preserve headers?

Procmail - Bounce a copy and preserve headers?

am 07.03.2005 17:05:23 von Shawn

I'm trying to make a procmail recipie that will bounce a copy of a
message to a user, and preserve the headers (especially the from
header).

I have 2 mail servers, a primary and a backup. What I'd like to do is
for every message that comes in for joe@test.com bounce a copy to
joe@backupmachine.com and preserve all the header information. That
way if joe accidently deletes his mail, there's a copy of it stored on
the backup machine for him.

So far I've been able to get procmail to send a copy over to the backup
machine, but the from address is always 'root@primary_machine.com'
which is not what I want.

Anyone have any ideas?


Thanks

Re: Procmail - Bounce a copy and preserve headers?

am 08.03.2005 00:42:18 von Alan Connor

On 7 Mar 2005 08:05:23 -0800, shawn@chartermi.net
wrote:

> I'm trying to make a procmail recipie that will bounce a copy
> of a message to a user, and preserve the headers (especially
> the from header).
>
> I have 2 mail servers, a primary and a backup. What I'd like
> to do is for every message that comes in for joe@test.com
> bounce a copy to joe@backupmachine.com and preserve all the
> header information. That way if joe accidently deletes his
> mail, there's a copy of it stored on the backup machine for
> him.
>
> So far I've been able to get procmail to send a copy over
> to the backup machine, but the from address is always
> 'root@primary_machine.com' which is not what I want.
>
> Anyone have any ideas?
>
>
> Thanks
>

Hi Shawn,

That just doesn't make sense. Would you describe _exactly_ the
route that a mail from someone to joe@test.com takes?

Is the mail received by an MTA that you control? If so, then I'm
pretty sure that _it_ should be configured to send the copies to
your backup server, not procmail.

And please post the procmail recipes you have tried.

goatherder.up.net ??

AC

Re: Procmail - Bounce a copy and preserve headers?

am 09.03.2005 17:45:41 von Shawn

Sure.

Mail ---> MX machine ----> Mail "server" (pop, etc)
\
---> Backup mail
"server"

I'd love to be able to have the MX machine simply send a copy to the
mail server and the backup mail server, however it's a spam and virus
filtering appliance and doesn't have that functionality. It also needs
to speak directly with the mail (pop) server, so I can't stick an extra
MX machine in between them.

So. my option now is to get either sendmail or procmail on the mail
server to bounce a copy over to the backup mail server. If the primary
mail server goes down, messages will queue up on the MX until i tell it
to deliver them directly to the backup.

Re: Procmail - Bounce a copy and preserve headers?

am 09.03.2005 23:10:50 von Alan Connor

On 9 Mar 2005 08:45:41 -0800, shawn@chartermi.net
wrote:


> Sure.
>
> Mail ---> MX machine ----> Mail "server" (pop, etc) \
> ---> Backup mail "server"

So the receiving MTA is before the MX machine.

That's rough.

>
> I'd love to be able to have the MX machine simply send a copy
> to the mail server and the backup mail server, however it's
> a spam and virus filtering appliance and doesn't have that
> functionality. It also needs to speak directly with the mail
> (pop) server, so I can't stick an extra MX machine in between
> them.
>
> So. my option now is to get either sendmail or procmail on the
> mail server to bounce a copy over to the backup mail server.
> If the primary mail server goes down, messages will queue up on
> the MX until i tell it to deliver them directly to the backup.
>

This isn't a job for sendmail or procmail. It's basicaly just an
ordinary backup job. Forget about them being mail servers. You
just want certain new/newly-appended-to files on box 1 to be
sent over to box 2 on a regular basis (cron).

There was a really good thread on this very subject here about
a year ago (I think that's the right time frame). Get into the
Archives at http://groups.google.com/advanced_group_search and
look for it.

(I'll grep through my local news cache and see if I can spot
it.)

This can be done with a fairly simple shell script and a TCP
connection between the two boxes/servers and a crontab.

Are they POP or IMAP?

AC

Re: Procmail - Bounce a copy and preserve headers?

am 10.03.2005 20:03:35 von Shawn

I'd prefer for it to happen real-time instead of cronning it. That's
how it happens at the moment.

Re: Procmail - Bounce a copy and preserve headers?

am 10.03.2005 21:34:40 von AK

shawn@chartermi.net wrote:

> I'm trying to make a procmail recipie that will bounce a copy of a
> message to a user, and preserve the headers (especially the from
> header).
>
> I have 2 mail servers, a primary and a backup. What I'd like to do is
> for every message that comes in for joe@test.com bounce a copy to
> joe@backupmachine.com and preserve all the header information. That
> way if joe accidently deletes his mail, there's a copy of it stored on
> the backup machine for him.
>
> So far I've been able to get procmail to send a copy over to the backup
> machine, but the from address is always 'root@primary_machine.com'
> which is not what I want.
>
> Anyone have any ideas?
>
>
> Thanks
>

Shawn,

You would need to extract the sender's address first.

:0c
* ^Return-Path: <\/[a-z0-9@_.+'-]+
| $SENDMAIL -oi -f$MATCH joe@backupmachine.com

This should do it.

AK

Re: Procmail - Bounce a copy and preserve headers?

am 10.03.2005 21:53:25 von Alan Connor

On 10 Mar 2005 11:03:35 -0800, shawn@chartermi.net
wrote:

> I'd prefer for it to happen real-time instead of cronning it.
> That's how it happens at the moment.
>

One more time: Are the servers POP or IMAP?

One more time: Post the procmail recipes that you have tried.

And tell us just where procmail is in the chain.


AC

Re: Procmail - Bounce a copy and preserve headers?

am 11.03.2005 00:54:59 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.

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

Beavis writes:

> On 10 Mar 2005 11:03:35 -0800, shawn@chartermi.net
> wrote:
>
>> I'd prefer for it to happen real-time instead of cronning it.
>> That's how it happens at the moment.
>>
>
> One more time: Are the servers POP or IMAP?
>
> One more time: Post the procmail recipes that you have tried.
>
> And tell us just where procmail is in the chain.

And the last, but not least important bit of advice:

Never listen to any advice Beavis gives you. The rule of thumb is that
whatever he says, the truth lies 180 degrees to the opposite.

See http://angel.1jh.com/nanae/kooks/alanconnor.shtml for more information.

Example: every time Beavis comes across someone making fun of him, he goes
back, replies to his own, earlier message chosen at random, and announces
how his amazing news filter heuristically identifies all messages that make
fun of him, and automatically delete them, or change their subject lines to
all X's, or some other shit like that.



--=_mimegpg-commodore.email-scan.com-26840-1110498899-0004
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

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

iD8DBQBCMN5Tx9p3GYHlUOIRAhuCAJwKhwmLf8ZCyXThh/YKFLy3vcM/4gCZ AcSP
jJzhVeckmCXdh3ltr64btb0=
=Anhf
-----END PGP SIGNATURE-----

--=_mimegpg-commodore.email-scan.com-26840-1110498899-0004--