procmail domain redirect

procmail domain redirect

am 31.10.2005 21:04:03 von rolandgust

calling any/all procmail gurus:

is it possible to use a procmail filter to redirect email to another
domain yet preserve the userID?

@somedomain.com
redirects to:
@myserver.com
which preserves the original @somedomain.com in a
"Delivered-To:" header
The procmail's job is to redirect again to:
@anotherdomain.com

I would be able to do this just fine if the $MATCH feature allowed
"fencing in" the userID portion but alas, it always selects through the
end of the line

:0
* ^Delivered-To: \/.*@somedomain\.com
! $MATCH@anotherdomain.com

This of course doesn't work because @somedomain.com needs to be
stripped off first.

Help! :-)

-Roland G.

Re: procmail domain redirect

am 01.11.2005 02:29:13 von Tim Heaney

"Roland G." writes:
>
> I would be able to do this just fine if the $MATCH feature allowed
> "fencing in" the userID portion but alas, it always selects through the
> end of the line
>
> :0
> * ^Delivered-To: \/.*@somedomain\.com
> ! $MATCH@anotherdomain.com
>
> This of course doesn't work because @somedomain.com needs to be
> stripped off first.

You could change the address with sed

:0
* ^Delivered-To: \/.*@somedomain\.com
! `echo $MATCH | sed s/somedomain/anotherdomain/`

I hope this helps,

Tim

Re: procmail domain redirect

am 01.11.2005 06:07:24 von AK

Roland G. wrote:
> calling any/all procmail gurus:
>
> is it possible to use a procmail filter to redirect email to another
> domain yet preserve the userID?
>
> @somedomain.com
> redirects to:
> @myserver.com
> which preserves the original @somedomain.com in a
> "Delivered-To:" header
> The procmail's job is to redirect again to:
> @anotherdomain.com
>
> I would be able to do this just fine if the $MATCH feature allowed
> "fencing in" the userID portion but alas, it always selects through the
> end of the line
>
> :0
> * ^Delivered-To: \/.*@somedomain\.com
> ! $MATCH@anotherdomain.com
>
> This of course doesn't work because @somedomain.com needs to be
> stripped off first.
>
> Help! :-)
>
> -Roland G.
>

Tim in a subsequent email provided an option. Here is another:
:0
* ^Delivered-To: \/[a-z0-9.+_-]
! $MATCH@anotherdomain.com

AK

Re: procmail domain redirect

am 01.11.2005 18:20:01 von rolandgust

Thanks so much, that worked! (As you probably knew!!) I had a feeling
it would require the use of sed, awk or somesuch thing, but I'm not
completely up to speed on what you can do in a procmail delivery line.

Thanks again!

-Roland