1

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.

0

4 Answers 4

6

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.

3
  • Setting it to loopback-only would be better, as that includes IPv6 too (if ipv6 is enabled in inet_protocols). Using 127.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.
    – willbeeler
    Commented Oct 13, 2009 at 15:40
  • 1
    This does not prevent postfix from receiving mail from localhost.
    – user130370
    Commented Nov 17, 2012 at 20:43
6
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.

1

you can also block the incoming port 25 with iptables

2
  • 1
    swatting flies with a sledgehammer.. I like it... :)
    – falstro
    Commented Oct 13, 2009 at 17:13
  • LOL @ roe. I'm sure it works though. :D
    – willbeeler
    Commented Oct 15, 2009 at 17:19
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .