Is it possible to tell Sendmail to Relay based on a Rule in Sendmail.cf, that it should make a SQL request on a Database and relay only the entry the SQL request gives back?
For example:
I have a user1 and a user2 both are in a SQL DB and user1 has a flag "standard" set and user2 not.
Now I want sendmail to search after that flag and relay this users mail to another server1. Like in this example:
Kalf regex -s1 -a<@alf.bigisp.com.> (^[a-k][^@]*)<@bigisp.com.>
Kbarney regex -s1 -a<@barney.bigisp.com.> (^[^a-k][^@]*)<@bigisp.com.>
These maps define how an address will be translated. The alf map looks for addresses that begin with a-k and are addressed to @bigisp.com. If this is found then then an address @alf.bigisp.com is returned. The barney map looks for addressed that do not begin with a-k and are addressed to @bigisp.com and returns and address @barney.bigisp.com To use regex maps you need either sendmail 8.8 patched with map-regex or sendmail 8.9. In either case you need to compile with DBMDEF= -DMAP_REGEX set in the Makefile [Krü].
These maps should be placed under the definition of Dn in sendmail.cf or under LOCAL_CONFIG in sendmail.mc the m4 preprocessor is used to generate you sendmail.cf. Now place the following under ruleset 98 in sendmail.cf or LOCAL_RULE_0 in sendmail.mc.
R$* $: $(alf $1 $)
R$* $: $(barney $1 $)
RERROR $* $#error $: $1
For example:
I have a user1 and a user2 both are in a SQL DB and user1 has a flag "standard" set and user2 not.
Now I want sendmail to search after that flag and relay this users mail to another server1. Like in this example:
Kalf regex -s1 -a<@alf.bigisp.com.> (^[a-k][^@]*)<@bigisp.com.>
Kbarney regex -s1 -a<@barney.bigisp.com.> (^[^a-k][^@]*)<@bigisp.com.>
These maps define how an address will be translated. The alf map looks for addresses that begin with a-k and are addressed to @bigisp.com. If this is found then then an address @alf.bigisp.com is returned. The barney map looks for addressed that do not begin with a-k and are addressed to @bigisp.com and returns and address @barney.bigisp.com To use regex maps you need either sendmail 8.8 patched with map-regex or sendmail 8.9. In either case you need to compile with DBMDEF= -DMAP_REGEX set in the Makefile [Krü].
These maps should be placed under the definition of Dn in sendmail.cf or under LOCAL_CONFIG in sendmail.mc the m4 preprocessor is used to generate you sendmail.cf. Now place the following under ruleset 98 in sendmail.cf or LOCAL_RULE_0 in sendmail.mc.
R$* $: $(alf $1 $)
R$* $: $(barney $1 $)
RERROR $* $#error $: $1