mailwrapper behaviour if mailer.conf can't be opened

From: Lexi Winter <lexi_at_le-fay.org>
Date: Thu, 18 Apr 2024 17:24:11 UTC
hello,

i submitted this change request:

https://github.com/freebsd/freebsd-src/pull/969

which was rejected for needing more discussion, so i'd like to discuss
that.

the current behaviour is that if mailwrapper cannot open mailer.conf for
any reason, it calls back to _PATH_DEFAULTMTA.  i think this behaviour
is bad, because:

- if the default MTA has not been configured, it may not be able to
  deliver mail

- if the admin has configured a different MTA, mailwrapper should not
  fall back to a different MTA because of transient errors

- this may hide mail delivery errors from applications by delivering the
  mail to the wrong MTA instead of returning a failure

with my change, mailwrapper will fall back to _PATH_DEFAULTMTA if
mailer.conf doesn't exist, which preserves mail functionality if the
admin has deleted mailer.conf for some reason.  but if mailer.conf can't
be opened for any other reason, it will exit with EX_OSERR, returning an
error to the application.

this was previously discussed on the PR:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=25218

where the argument was made that it's better to make a 'last ditch'
attempt to deliver mail if mailer.conf can't be opened.  i disagree with
this, for the reasons above, and in addition because modern systems
generally do not rely on mail delivery to report serious errors -- they
are monitored by an external NMS.