|
|
|
|
||||||
| comp.mail.sendmail Configuring and using the BSD sendmail agent. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. . . . |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"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] |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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. . . . |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"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] |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|