ProblemYou have been asked to configure sendmail to add a hostname to every header sender address, even when the input address has no hostname part and the mail is being delivered by the local mailer. SolutionAdd the always_add_domain feature to the sendmail configuration. The command that you add is: dnl Add the domain to all sender addresses FEATURE(`always_add_domain') Using Recipe 1.8 as a guide, build and install the sendmail configuration and then restart sendmail. DiscussionThe always_add_domain feature causes sendmail to make sure that every sender address includes a hostname part. By default, sendmail does not add a hostname part to the sender address when the address has no hostname part and the local mailer is delivering the mail. Thus, mail from the address alana goes through the local mailer's header sender process unchanged when the default configuration is used, as this test shows: # sendmail -bt -Cgeneric-linux.cf ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > /tryflags HS > /try local alana Trying header sender address alana for mailer local canonify input: alana Canonify2 input: alana Canonify2 returns: alana canonify returns: alana 1 input: alana 1 returns: alana HdrFromL input: alana MasqHdr input: alana MasqHdr returns: alana HdrFromL returns: alana final input: alana final returns: alana Rcode = 0, addr = alana > /quit Rerunning the test after adding the always_add_domain feature to the configuration shows a different result: # sendmail -bt ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > /tryflags HS > /try local alana Trying header sender address alana for mailer local canonify input: alana Canonify2 input: alana Canonify2 returns: alana canonify returns: alana 1 input: alana 1 returns: alana HdrFromL input: alana AddDomain input: alana AddDomain returns: alana < @ *LOCAL* > MasqHdr input: alana < @ *LOCAL* > MasqHdr returns: alana < @ chef . wrotethebook . com . > HdrFromL returns: alana < @ chef . wrotethebook . com . > final input: alana < @ chef . wrotethebook . com . > final returns: alana @ chef . wrotethebook . com Rcode = 0, addr = alana@chef.wrotethebook.com > /quit Here, the address goes in as alana and comes out with the hostname added as alana@chef.wrotethebook.com. See AlsoRecipe 4.4 shows how the always_add_domain feature can be used with masquerading. The sendmail book covers always_add_domain in Section 4.8.4. |