Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

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.

share|improve this answer
    
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. –  grawity Oct 13 '09 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 Oct 13 '09 at 15:40
    
This does not prevent postfix from receiving mail from localhost. –  coincoin Nov 17 '12 at 20:43

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 fred@my.domain.ext 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.

share|improve this answer

you can also block the incoming port 25 with iptables

share|improve this answer
1  
swatting flies with a sledgehammer.. I like it... :) –  falstro Oct 13 '09 at 17:13
    
LOL @ roe. I'm sure it works though. :D –  willbeeler Oct 15 '09 at 17:19
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.