PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Logiciels d'hébergement > comp.mail.sendmail > multiple procmailrc's on relay/gateway
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.mail.sendmail Configuring and using the BSD sendmail agent.

multiple procmailrc's on relay/gateway

Réponse
 
LinkBack Outils de la discussion
Vieux 24/01/2007, 18h18   #1
Dave
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut multiple procmailrc's on relay/gateway

Not sure if this is the right group, so if its not I apologise and
please someone let me know the right one.

Currently we have procmail running on a gateway which relays approx 5
different domains inside to an exchange server.

In the last few months I have been asked to setup a few complex
procmail filters based on incoming domain and I can see them increasing
throughout the year. As you can imagine this is getting harder to
decide which recipes should come before others.

Ideally i would like to first decide which domain the email is for,
then run a seperate procmailrc soley for that domain.

so:
email comes in -> run procmailrc -> rule1 (who is email for)
email is for domain1 -> run domain1.procmailrc
email is for domain2 -> run domain2.procmailrc
etc..

instead of having to put many different rules in the same file, and
trying hard to make sure that rule 33 has to be above rule 34 but rule
56 has to come after rule 55 etc..

If its not possible to call seperate files dependant on domain name, is
it possible to skip recipes like you can in shell/batch files (ie if
email is for domain3 goto recipe 34)

Hope this makes sense to anyone who can and point me in the right
direction

Thanks in andvance

Dave

  Réponse avec citation
Vieux 24/01/2007, 18h27   #2
Grant Taylor
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway

Dave wrote:
> Not sure if this is the right group, so if its not I apologise and
> please someone let me know the right one.


I don't know if this is the *BEST* place to ask or not, but it will work.

> In the last few months I have been asked to setup a few complex
> procmail filters based on incoming domain and I can see them increasing
> throughout the year. As you can imagine this is getting harder to
> decide which recipes should come before others.


Indeed.

> Ideally i would like to first decide which domain the email is for,
> then run a seperate procmailrc soley for that domain.
>
> so:
> email comes in -> run procmailrc -> rule1 (who is email for)
> email is for domain1 -> run domain1.procmailrc
> email is for domain2 -> run domain2.procmailrc
> etc..
>
> instead of having to put many different rules in the same file, and
> trying hard to make sure that rule 33 has to be above rule 34 but rule
> 56 has to come after rule 55 etc..
>
> If its not possible to call seperate files dependant on domain name, is
> it possible to skip recipes like you can in shell/batch files (ie if
> email is for domain3 goto recipe 34)


I'm not sure you can selectively call separate files or not, but you can
separate things out.

First, you can include multiple files in to your procmailrc file with
out a problem.

INCLUDERC=<file>

This is nothing more than a very simple include the contents of this
other file in to this file.

You could make the contents of each file be for each domain.

file1.procmailrc
:<flags>
{
recipe for domain 1
{
}
recipe for domain 1
{
}
}

file2.procmailrc
:<flags>
{
recipe for domain 2
{
}
recipe for domain 2
{
}
}

Then include the separate files in procmailrc.

INCLUDERC=file1.procmailrc
INCLUDERC=file2.procmailrc

You would selectively test if a message was for a domain and then only
run the sub-recipes if a message is for that domain



Grant. . . .

  Réponse avec citation
Vieux 24/01/2007, 19h26   #3
Andrzej Adam Filip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway

"Dave" <david.greenhall@praybourne.co.uk> writes:
> [...]
> Ideally i would like to first decide which domain the email is for,
> then run a seperate procmailrc soley for that domain.
>
> so:
> email comes in -> run procmailrc -> rule1 (who is email for)
> email is for domain1 -> run domain1.procmailrc
> email is for domain2 -> run domain2.procmailrc
> etc..
> [...]


You can select procmail mailer with specific filter script
"per recipient domain" in mailertable.
[procmail mailer is different procmail acting as local mailer ]

mailertable:
example.com procmail:/etc/procmailrcs/example_com.rc
example.net procmail:/etc/procmailrcs/example_net.rc

* FEATURE(`mailertable') does not work for local email domains listed in
$=w
echo '$=w' | sendmail -bt
* procmail mailer provided by sendmail.org calls procmail per every
recipient. To change it use
MODIFY_MAILER_FLAGS(`PROCMAIL',`+m')

BTW procmail treats scripts in /etc/procmailrcs/ in a special way.

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Before You Ask: http://anfi.homeunix.net/sendmail/B4UAsk-Sendmail.html
http://anfi.homeunix.net/sendmail/ [orkut,linkedin,xing]
  Réponse avec citation
Vieux 24/01/2007, 20h19   #4
Dave
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway



On 24 Jan, 19:26, Andrzej Adam Filip <a...@onet.eu> wrote:
> "Dave" <david.greenh...@praybourne.co.uk> writes:
> > [...]
> > Ideally i would like to first decide which domain the email is for,
> > then run a seperate procmailrc soley for that domain.

>
> > so:
> > email comes in -> run procmailrc -> rule1 (who is email for)
> > email is for domain1 -> run domain1.procmailrc
> > email is for domain2 -> run domain2.procmailrc
> > etc..
> > [...]You can select procmail mailer with specific filter script

> "per recipient domain" in mailertable.
> [procmail mailer is different procmail acting as local mailer ]
>
> mailertable:
> example.com procmail:/etc/procmailrcs/example_com.rc
> example.net procmail:/etc/procmailrcs/example_net.rc
>
> * FEATURE(`mailertable') does not work for local email domains listed in
> $=w
> echo '$=w' | sendmail -bt
> * procmail mailer provided by sendmail.org calls procmail per every
> recipient. To change it use
> MODIFY_MAILER_FLAGS(`PROCMAIL',`+m')
>
> BTW procmail treats scripts in /etc/procmailrcs/ in a special way.
>
> --
> [pl>en: Andrew] Andrzej Adam Filip : a...@priv.onet.pl : a...@xl.wp.pl
> Before You Ask:http://anfi.homeunix.net/sendmail/B4....net/sendmail/[orkut,linkedin,xing]


OK, i think i understand, but just to be sure...

Currently in my mailertable is:
domain.local esmtp:[10.10.10.200]

So i would change this to:
domain1 procmail:/etc/procmailrcs/domain1.rc
domain2 procmail:/etc/procmailrcs/domain2.rc
domain3 procmail:/etc/procmailrcs/domain3.rc
domain.local esmtp:[10.10.10.200]

Then in the sendmail.cf (this bit has me confused, and even after
reading your reply and going to sendmails website to read up on what
you suggest, im non the wiser (

But, this is the relevant part of my sendmail.cf file currently:

LOCAL_RULESETS

LOCAL_RULE_0
R$* < @ $=w > $* $#procmail $@
/etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
R$* < @ $=w. > $* $#procmail $@
/etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
R$* < @$* .procmail. > $* $1<@$2.>$3 Already filtered, map to original
address

FEATURE(`local_procmail')
MAILER(local)
MAILER(smtp)
MAILER(procmail)


If i understand you correctly, i take out this first part that calls
the procmailrc-alldomains/procmailrc and replace it with:


LOCAL_RULE_0
FEATURE(`mailertable')
echo '$=w' | sendmail -bt
MODIFY_MAILER_FLAGS(`PROCMAIL',`+m')

FEATURE(`local_procmail')
MAILER(local)
MAILER(smtp)
MAILER(procmail)

If this is all correct, i already have a FEATURE(`mailertable`) do i
remove this?

Thanks

Dave.

  Réponse avec citation
Vieux 24/01/2007, 23h23   #5
Grant Taylor
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway

Andrzej Adam Filip wrote:
> You can select procmail mailer with specific filter script
> "per recipient domain" in mailertable.


Won't this cause Sendmail to hand the message off to procmail more like
an LDA and trusting it to successfully send the message to the next mail
server, verses Sendmail handing the message directly to the next mail
server? Or was the OP handing the message to procmail and trusting it
to hand it off any way?



Grant. . . .

  Réponse avec citation
Vieux 25/01/2007, 09h27   #6
Andrzej Adam Filip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway

"Dave" <david.greenhall@praybourne.co.uk> writes:
> [...]
> But, this is the relevant part of my sendmail.cf file currently:
>
> LOCAL_RULESETS
>
> LOCAL_RULE_0
> R$* < @ $=w > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> R$* < @ $=w. > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> R$* < @$* .procmail. > $* $1<@$2.>$3 Already filtered, map to original address
>
> [...]


[ to save a lot of time for explanations ]

Simply add per "special domain" lines as the first two with:
1) the domain name instead of $=w
2) modified procmail script path

P.S.
BTW AFAIK the first line (without dot after $=w) is not necessary for
local email domains (domains listed in $=w).

--
[pl>en: Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
Before You Ask: http://anfi.homeunix.net/sendmail/B4UAsk-Sendmail.html
http://anfi.homeunix.net/sendmail/ [orkut,linkedin,xing]
  Réponse avec citation
Vieux 25/01/2007, 10h44   #7
Dave
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway



On 25 Jan, 09:27, Andrzej Adam Filip <a...@onet.eu> wrote:
> "Dave" <david.greenh...@praybourne.co.uk> writes:
> > [...]
> > But, this is the relevant part of my sendmail.cf file currently:

>
> > LOCAL_RULESETS

>
> > LOCAL_RULE_0
> > R$* < @ $=w > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> > R$* < @ $=w. > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> > R$* < @$* .procmail. > $* $1<@$2.>$3 Already filtered, map to original address

>
> > [...][ to save a lot of time for explanations ]

>
> Simply add per "special domain" lines as the first two with:
> 1) the domain name instead of $=w
> 2) modified procmail script path
>
> P.S.
> BTW AFAIK the first line (without dot after $=w) is not necessary for
> local email domains (domains listed in $=w).
>
> --
> [pl>en: Andrew] Andrzej Adam Filip : a...@priv.onet.pl : a...@xl.wp.pl
> Before You Ask:http://anfi.homeunix.net/sendmail/B4....net/sendmail/[orkut,linkedin,xing]


Thanks for the Andrzej, one last question.... Do i still need to
alter the mailertable like you suggested before?

Dave.

  Réponse avec citation
Vieux 25/01/2007, 13h35   #8
Dave
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: multiple procmailrc's on relay/gateway



On 25 Jan, 10:44, "Dave" <david.greenh...@praybourne.co.uk> wrote:
> On 25 Jan, 09:27, Andrzej Adam Filip <a...@onet.eu> wrote:
>
>
>
>
>
> > "Dave" <david.greenh...@praybourne.co.uk> writes:
> > > [...]
> > > But, this is the relevant part of my sendmail.cf file currently:

>
> > > LOCAL_RULESETS

>
> > > LOCAL_RULE_0
> > > R$* < @ $=w > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> > > R$* < @ $=w. > $* $#procmail $@ /etc/mail/procmailrc-alldomains/procmailrc $: $1<@$2.procmail.>$3
> > > R$* < @$* .procmail. > $* $1<@$2.>$3 Already filtered, map to original address

>
> > > [...][ to save a lot of time for explanations ]

>
> > Simply add per "special domain" lines as the first two with:
> > 1) the domain name instead of $=w
> > 2) modified procmail script path

>
> > P.S.
> > BTW AFAIK the first line (without dot after $=w) is not necessary for
> > local email domains (domains listed in $=w).

>
> > --
> > [pl>en: Andrew] Andrzej Adam Filip : a...@priv.onet.pl : a...@xl.wp.pl
> > Before You Ask:http://anfi.homeunix.net/sendmail/B4...ttp://anfi.hom...[orkut,linkedin,xing]Thanks for the Andrzej, one last question.... Do i still need to

> alter the mailertable like you suggested before?
>
> Dave.- Hide quoted text -- Show quoted text -



Well i have tried all different ways to get your suggestion working,
but still cannot figure it out.

I added the extra lines to sendmail.cf on there own, but when an email
came in it just ignored them and used the original procmail file. I
have tried adding the info to mailertable and the extra info to
sendmail.cf regarding the the MODIFY_MAILER_FLAGS, but again it didnt
work, all emails coming in just used the original procmail file i have
in place.

Any suggestions would be much appreciated.

Dave.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h03.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,23119 seconds with 16 queries