I want to make Postfix unable to receive mail. I just want to be able to send mail with Postfix, not the other way around. Is that possible? If so, can anyone tell me how to do that? Thanks.
4 Answers
Inside your (/etc/postfix/)main.cf:
inet_interfaces = 127.0.0.1
This way it only listen to localhost (via loopback). Make sure you restart (or reload) the server after change.
-
Setting it to
loopback-only
would be better, as that includes IPv6 too (ifipv6
is enabled ininet_protocols
). Using127.0.0.1
is not a problem here, but I myself do care about such things. Commented Oct 13, 2009 at 13:21 -
Thanks. This is what I ended up doing. Basically, my clients are using Google Apps and I need postfix just for the PHP mail() command. Thanks again. Commented Oct 13, 2009 at 15:40
-
1This does not prevent postfix from receiving mail from localhost.– user130370Commented Nov 17, 2012 at 20:43
dpkg-reconfigure postfix
Choose satellite system.
Provide your ISP's smtp server as the smarthost.
Preferrably choose a valid domain name to mask local adresses.
When asked about which subnets to listen on, provide only the loopback interface's 127.0.0.1
Similarly, only provide localhost (and optionally the hostsname) as final mail destination.
The system will now support a minimum of local mail delivery, accept no mail from external hosts and send all outgoing mail through the smarthost.
you can also block the incoming port 25 with iptables
-
1
-
Coolwater and Roy are correct, by default 'Satellite' will still internally deliver full addresses for your own hostname. This is wrong for anyone with third party or external MX records. Many options available in reconfigure are not available during install.
So if you want mail to 'fred' to be delivered locally but not [email protected]
then edit mydestination
in /etc/postfix/main.cf
or possibly /usr/share/postfix/main.cf.dist
mydestination = localhost.org, localhost
and (to strictly address the question) only send fully qualified mail. The system may still send local mail (cron output etc.) but handling these (aliases, redirection, masquerading, /dev/null
) is beyond the scope of the OP's question.