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 be able to send mail to someuser@localhost but not allow any mail to go out to the outside world from anyone to anyone. i've seen multiple entries about how to filter or restrict outgoing mail, but it seems like there should be a simpler way to just turn it off.

i would like to still be able to use something like PHPMailer to explicitly log in to an outside SMTP server and send mail that way, though. i don't know if these goals are compatible or not. i am pretty sure that this is how it used to work when i was running Ubuntu 9.04. i've upgraded to 11.04 and now mail will go out to any address without a problem.

share|improve this question
    
I think you want to look into making a transport_maps entry in main.cf that will tell postfix to deliver certain domains/host locally and deliver the rest to 'error: some message' but I'm not confident about that. I usually start here with postfix: postfix.org/STANDARD_CONFIGURATION_README.html –  Kyle Smith May 18 '11 at 23:56

1 Answer 1

up vote 4 down vote accepted

I think setting default_transport = error: This server sends mail only locally. should work.

share|improve this answer
    
that works fine to stop outgoing mail. the only slight trouble is that it stops ALL outgoing mail of any kind. at one point in the past, though, somehow i had it so that trying to send outbound mail using, say, the mail command from the shell, or the mail() function in PHP, would fail, but code like phpmailer could still make authorized connections to outside SMTP servers like google and send mail out that way. still, i'd much rather have that as a to-do and know that in the meantime nothing is going out, so this is fine for now. thanks! –  tatere May 20 '11 at 4:24
    
Both mail binary and mail() PHP function (on *nix systems) use /usr/sbin/sendmail to pass email to local system MTA (postfix), so you need to use SMTP to some other server to bypass local postfix. –  AlexD May 20 '11 at 6:48

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.