Sendmail Mangling for HylaFAX faxmail

Faxmail is quite handy to fax a short notice to somebody who does not have an e-mail account. Or the other way round, have your own received mail forwarded by fax to yourself somewhere, like on your 80 ft yacht :-)

Faxmail is able to handle PostScript and other configurable types of images natively as MIME encoded parts (attachments), but please see faxmail(1) for more specific and better information.

Now, there are two ways to configure sendmail . 

I. You can either  add to your .mc file, that is linux.mc or OS-Type.mc, or to
your .m4 file the following:

        define(`FAX_MAILER_PATH',`/usr/bin/faxmail')dnl
        define(`FAX_MAILER_ARGS',`faxmail -d -n -p 12pt $u@$h $f')dnl
        MAILER(`fax')dnl

While the path to faxmail might be different, depending on OS-Type and
distribution, the arguments can be taken from man (1) faxmail.
After adding to your mail.mc or m4 file, you have to translate the
file with the m4 macros. That is 

                # m4 mail.mc > sendmail.cf

II. Or can do it the hard way and edit your sendmail.cf  :-)

add to 'local info'

CPREDIRECT

CPFAX

add to 'Rewriting Rules; Ruleset 0; Parse1 -- bottom half'

# resolve fake top level domains by forwarding to other hosts
R$+ < @ $+ .FAX. >      $#fax $@ $2 $: $1        user@host.FAX

add to 'Mailer Definitions'

##   FAX Mailer specification   ##

#####  @(#)fax.m4       8.11 (Berkeley) 5/19/1998  #####

Mfax,       P=/usr/bin/faxmail, F=DFMhu, S=14, R=24, M=100000,
                                    T=X-Phone/X-FAX/X-Unix ,
                                    A=faxmail -d -n -p 12pt $u@$h $f

It is quite important tha you do not use the feature allmasquerade in
your sendmail configuration as this feature would include the
masquerading of the domain fax.

The mail address would be something like
                To: joe.brown@0123456.fax

Note:

This is part of local info, 

##################
#   local info   #
##################

Cwlocalhost

[several local declarations]

CPREDIRECT
 
CPFAX

Cw localhost
##################


If you do not want the addressing to be of the form: joe.brown@0123456.fax, but instead 
want the addressing to be of the form: joe.brown@0123456.fax.yourdomain.com then...

First challenge is a DNS one:  Set up a pseudo domain.  Note that RFCs on sendmail make 
warnings about pseudo domains.  This is perhaps one of the few valid uses of pseudo domains.

Given a host name of the HylaFAX server of fax.yourdomain.com create the following DNS record:

*.fax.yourdomain.com.   IN   MX   10    fax.yourdomain.com.

Next are changes in sendmail.  In your relay-domain file add the line:

fax.yourdomain.com

Append these lines to your sendmail.mc file:

define(`FAX_MAILER_PATH',`/usr/bin/faxmail')dnl
define(`FAX_MAILER_ARGS',`faxmail -d -n -p 12pt $u@$h $f')dnl
MAILER(`fax')dnl

make the sendmail.cf file and edit the line:

R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1	user@host.FAX

to

R$+ < @ $+ .fax.yourdomain.com. >	$#fax $@ $2 $: $1	user@host.fax.yourdomain.com

Customize from this point to your needs.

To avoid having to edit sendmail.cf every time you change sendmail.mc you can edit:

/usr/share/sendmail-cf/m4/proto.m4      (this is where it is in Centos 5)

Then you probably only have to make the changes when you get a bind update.

Many thanks go to Dieter Kluenter dkluenter@gmx.de for this information, to Jay R. Ashworth jra@baylink.com for his comments, to Manfred Larcher manfred.larcher@zurich.com for his corrections, and to Robert Moskowitz for the fax.yourdomain.com alternative.