[BUGS] Sendmail as forwarder

John Marshall John.Marshall at riverwillow.com.au
Wed Jan 2 08:11:29 EST 2008


Jerahmy Pocott wrote:
> Is there any simple way to set sendmail to forward out going mail to  
> an upstream relay if it's not destined for the local host/domain,  
> rather than it trying to deliver the mail directly? I know the usual  
> recommendation for this is to replace sendmail with something like  
> ssmtp because sendmail is too complicated, but I'm not afraid of  
> complicated and I want to use sendmail for intranet mail. Which means  
> that if the address is outside the intranet it gets rejected because  
> the server doesn't actually map to any dns name externally.

I *think* I know what you mean.
- You want to deliver local mail to the local machine
- You want to deliver user at my.internal.domain inside
- You want everything else to relay via (e.g. your ISP's) outbound relay)

I've quite likely misunderstood something, so have a look at the 
following for lots and lots of options for sendmail configuration:
<http://www.sendmail.org/doc/sendmail-current/cf/README>

You probably want either:
define(`SMART_HOST', `mail.myisp.com')

-OR-

FEATURE(`mailertable')
with a /etc/mail/mailertable that looks like this:

my.local.domain		esmtp:[mail-hub.my.local.domain]
.			esmtp:[mail.myisp.com]

The "." is a catch-all for any domain not already listed in mailertable. 
You can use the mailertable to direct mail for different domains to 
different hosts.

...and don't forget to build the mailertable.db file with makemap:
  cd /etc/mail
  makemap hash mailertable < mailertable

Please read the sendmail documentation via the link above. It describes 
how these customizations work.

-- 
John Marshall


More information about the BUGS mailing list