Fixing sendmail configuration

I found the following errors after installing sendmail:

apt-get install sendmail:

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()

Starting Mail Transport Agent (MTA): sendmail.
Setting up sensible-mda (8.14.3-9.4) ...
Setting up sendmail (8.14.3-9.4) ...

Apparently sendmail.cf located at /etc/mail/sendmail.cf is automatically generated. To fix the issue, edit /etc/mail/sendmail.mc

#grep -in FEATURE\(\`always_add_domain\'\) ./etc/mail/sendmail.mc
106:FEATURE(`always_add_domain')dnl

#grep -in MAILER ./etc/mail/sendmail.mc
100:dnl # Default Mailer setup
101:MAILER_DEFINITIONS
102:MAILER(`local')dnl
103:MAILER(`smtp')dnl

I edited the lines from #100, and switched the positions of the MAILER and FEATURE tags.

Once edited, sendmail.cf should be autoregenerated with:

sendmailconfig