Postfix relayhost parameter for a null client

configurationpostfix

I'm trying to set up postfix as a null client, that is, I just want local linux users to be able to send mails outside using postfix's sendmail binary.

No reception of emails, no relaying for other hosts, no local mail delivery to users (I don't see any use for it).
I just want to allow sending emails outside.

I have set these parameters in /etc/postfix/main.cf:

myhostname = mail.thisisadomain.com
inet_interfaces = loopack-only
mydestination = 

Should I set other parameters or change anything else in the configuration ?

I'm particularly interested in knowing what to do with the relayhost parameter, since I don't understand what it does.

I've read the doc here http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client but I still don't understand what the relayhost parameter does, and if it matters for a null client.

Thanks for your help.

Best Answer

As far as I understood, the author of http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client assumed that null client is not an always-online-server e.g. sometimes it can safely be turn off or isolated from internet. This snippet from that page

1 /etc/postfix/main.cf:
2     myhostname = hostname.example.com
3     myorigin = $mydomain
4     relayhost = $mydomain
5     inet_interfaces = loopback-only
6     mydestination =
...
Line 4: Forward all mail to the mail server that is responsible for the "example.com" domain.
This prevents mail from getting stuck on the null client if it is turned off while some remote destination is unreachable. 

Without relayhost parameter, whenever the null client turned off, the email on your deferred queue will not retried until the server goes back online or turn on. So it possible when your machine turn on, the email queue already expired.

The reason why you should provide relayhost parameter is no matter the state of your box (online or offline), the relayhost server (the one who always stays online) will retry the stuck emails from your null client.

Related Topic