Hello all,
If you are familiar with Sendmail, then I'm sure this question is a very basic one, but I've been trying hard to figure out myself without any success.
Basically, I have to redirect all
xxxxx@01234567.FAX addresses to the faxmail program. Right now, all TLD "fax" try to get resolved instead of being recognized correctly as a fake TLD. Since the sendmail.cf is so long, I will include only the relevant parts here. If I miss one important part, just let me know, I'll add it later.
Code:
######################################################################
######################################################################
#####
##### SENDMAIL CONFIGURATION FILE
#####
##### built by root on Die Nov 2 11:37:34 CET 2004
##### in /etc/mail
##### using /usr/share/sendmail-cf/ as configuration include directory
#####
######################################################################
#####
##### DO NOT EDIT THIS FILE! Only edit the source .mc file.
#####
######################################################################
######################################################################
##### $Id: cfhead.m4,v 8.108.2.6 2003/12/05 02:26:47 ca Exp $ #####
##### $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $ #####
####################################
### FAX Mailer specification ###
####################################
##### $Id: fax.m4,v 8.16 2001/11/12 23:11:34 ca Exp $ #####
Mfax, P=/usr/local/bin/faxmail, F=DFMhu, S=14, R=24,
M=100000, T=X-Phone/X-FAX/X-Unix,
A=faxmail -d $u@$h $f
##### $Id: linux.m4,v 8.13 2000/09/17 17:30:00 gshapiro Exp $ #####
##### $Id: local_procmail.m4,v 8.21.42.1 2002/11/17 04:25:07 ca Exp $ #####
Code:
# dequoting map
Kdequote dequote
# class E: names that should be exposed as from this host, even if we masquerade
# class L: names that should be delivered locally, even if we have a relay
# class M: domains that should be converted to $M
# class N: domains that should not be converted to $M
#CL root
C{E}root
C{w}localhost.localdomain
# my name for error messages
DnMAILER-DAEMON
CPREDIRECT
CPFAX
##### setup for Red Hat Linux #####
Code:
######################################
### Ruleset 0 -- Parse Address ###
######################################
Sparse=0
R$* $: $>Parse0 $1 initial parsing
R<@> $#local $: <@> special case error msgs
R$* $: $>ParseLocal $1 handle local hacks
R$* $: $>Parse1 $1 final parsing
#
# Parse0 -- do initial syntax checking and eliminate local addresses.
# This should either return with the (possibly modified) input
# or return with a #error mailer. It should not return with a
# #mailer other than the #error mailer.
#
SParse0
R<@> $@ <@> special case error msgs
R$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
R@ <@ $* > < @ $1 > catch "@@host" bogosity
R<@ $+> $#error $@ 5.1.3 $: "553 User address required"
R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"
R$* $: <> $1
R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4
R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4
R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"
R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
R<> $* $1
R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"
R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"
R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"
# now delete the local info -- note $=O to find characters that cause forwarding
R$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user
R< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...
R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
R< @ $+ > $#error $@ 5.1.3 $: "553 User address required"
R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"
R$* $=O $* < @ *LOCAL* >
$@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
R$* < @ *LOCAL* > $: $1
#
# Parse1 -- the bottom half of ruleset 0.
#
SParse1
# handle numeric address spec
R$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec
R$* < @ [ $+ ] > $* $: $1 < @ [ $2 ] : $S > $3 Add smart host to path
R$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send
R$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer
R$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer
# handle virtual users
R$+ $: <!> $1 Mark for lookup
R<!> $+ < @ $={VirtHost} . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<!> $+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+ + $+ < @ $* . >
$: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $* . >
$: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $* . >
$: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . >
R<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+ $: $1
R<!> $+ $: $1
R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
R< $+ > $+ < @ $+ > $: $>Recurse $1
# short circuit local delivery so forwarded email works
R$=L < @ $=w . > $#local $: @ $1 special local names
R$+ < @ $=w . > $#local $: $1 regular local name
# not local -- try mailer table lookup
R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name
R< $+ . > $* $: < $1 > $2 strip trailing dot
R< $+ > $* $: < $(mailertable $1 $) > $2 lookup
R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3 check -- resolved?
R< $+ > $* $: $>Mailertable <$1> $2 try domain
# resolve remotely connected UUCP links (if any)
# resolve fake top level domains by forwarding to other hosts
R$+ < @$+.FAX > $#fax $@ $2 $: $1 user@host.FAX
# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name
# deal with other remote names
R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
# handle locally delivered names
R$=L $#local $: @ $1 special local names
R$+ $#local $: $1 regular local names
###########################################################################
### Ruleset 5 -- special rewriting after aliases have been expanded ###
###########################################################################
Here's some tests I did. Notice that my .fax addresses to #local in ruleset 0 instead of #fax:
Code:
# sendmail -Csendmail.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 0 test@0123456789.fax
parse input: test @ 0123456789 . fax
Parse0 input: test @ 0123456789 . fax
Parse0 returns: test @ 0123456789 . fax
ParseLocal input: test @ 0123456789 . fax
ParseLocal returns: test @ 0123456789 . fax
Parse1 input: test @ 0123456789 . fax
Parse1 returns: $# local $: test @ 0123456789 . fax
parse returns: $# local $: test @ 0123456789 . fax
# sendmail -Csendmail.cf -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 3,0 test@0123456789.fax
canonify input: test @ 0123456789 . fax
Canonify2 input: test < @ 0123456789 . fax >
Canonify2 returns: test < @ 0123456789 . fax . >
canonify returns: test < @ 0123456789 . fax . >
parse input: test < @ 0123456789 . fax . >
Parse0 input: test < @ 0123456789 . fax . >
Parse0 returns: test < @ 0123456789 . fax . >
ParseLocal input: test < @ 0123456789 . fax . >
ParseLocal returns: test < @ 0123456789 . fax . >
Parse1 input: test < @ 0123456789 . fax . >
Mailertable input: < 0123456789 . fax > test < @ 0123456789 . fax . >
Mailertable input: 0123456789 . < fax > test < @ 0123456789 . fax . >
Mailertable returns: test < @ 0123456789 . fax . >
Mailertable returns: test < @ 0123456789 . fax . >
MailerToTriple input: < > test < @ 0123456789 . fax . >
MailerToTriple returns: test < @ 0123456789 . fax . >
Parse1 returns: $# esmtp $@ 0123456789 . fax . $: test < @ 0123456789 . fax . >
parse returns: $# esmtp $@ 0123456789 . fax . $: test < @ 0123456789 . fax . >
I assume my error is in Ruleset 0, but if some specialist could point me into the right direction, I'd be very grateful.
ricky