Problem

I usually use the sendmail program to send out emails from my Debian system. Recently I tried to do some changes to my /etc/mail/sendmail.mc file and after making the changes I had to generate the /etc/mail/sendmail.cf file by using any one of the following commands:

make   (or make -C /etc/mail)
or
sendmailconfig
or
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

I decided to use the last command (m4) and to my surprise I got the following error message:

Errors in generating sendmail.cf
*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`always_add_domain')*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`allmasquerade')*** ERROR: FEATURE() should be before MAILER()

After that I tried to test the sendmail program from one my LAMP applications like mediawiki and it was working fine i.e. it was able to send emails which basically means the error does not make the program unusable but still when you are working on a production Debian system errors like these makes you nervous.

It seems that there are couple of bug reports already filed on the Debian Bug Tracking System but no action has been taken on them so far which basically means that the maintainer perhaps do not think it is worth enough to fix it which is surprisingly.

Solution

The easiest way to fix this is to switch the”Masquerading options” and the “Default Mailer setup” options which are at the very end of the sendmail.mc file like this:


dnl # Masquerading options
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mail.koolwal.net')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl

dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local’)dnl
MAILER(`smtp’)dnl

and now regenerating the sendmail.cf file does not give any errors:

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
#

I don’t know if this is the perfect solution or not but it works. If anybody has a better solution then please let us all know by commenting on this post.

Be Sociable, Share!