[SWLUG] Mail server headaches!

Dave Cridland dave at cridland.net
Mon Feb 11 14:07:48 UTC 2008


On Mon Feb 11 12:13:25 2008, Pete Phillips wrote:
> It is almost impossible to set postfix up to do only this.

Not that a simpler MTA isn't what you need, but postfix itself is  
pretty simple to configure for this - only two lines of this email  
are needed, the rest is some background and optional stuff.

I'll start by assuming that you're using a Debian-like package of  
postfix, and not attempting to configure from scratch. (The latter is  
possible, but requires more typing).

You'll need to check that whatever's sending the mail is doing so  
using a good  return-path - ie, the one you actually want. If it's  
not, you'll need  to rewrite these, which basically means:

echo 'user real.mail at real.domain.example.net' >/etc/postfix/canonical
postmap /etc/postfix/canonical

Obviously, replace both "user" with the actual user doing to mailing  
- www-user or whatever - and the email address needs correcting.

Next up, you want to change the transport for all mail. Which is  
equally easy.

echo 'default_transport = smtp:mailhost.zen.co.uk'   
 >/etc/postfix/main.cf
postfix reload

This overrides the nexthop on the default transport (normally simply   
smtp), which causes postfix not to bother with DNS lookups, and just  
sends directly to Zen's mailhost. (Which is mailhost.zen.co.uk).

It won't affect decisions for other sorts of mail routing. In  
particular, you could still tell Postfix to act as an MX secondary  
for a domain, by adding it to relay_domains, and it won't then use  
Zen.

Real postfix nuts will observe that there's a relayhost variable for  
this, too, which is slightly more obvious, but this *will* affect  
both "formal relaying" and general sending, and so it's slightly less  
flexible, but for completeness, you could have also done:

echo 'relayhost = mailhost.zen.co.uk' >/etc/postfix/main.cf
postfix reload

Which will do - kind of - the same as above. See man 5 transport for  
the subtle differences.

If you accidentally do both, it'll still work - relayhost will simply  
be ignored for the sending case.

HTH,

Dave.
-- 
Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade



More information about the Swlug mailing list