Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple domains and I want to install postfix to send emails only. How can I do this on ubuntu?

share|improve this question
What does "send mail only" mean ? – adaptr Mar 15 '12 at 8:59
To send emails only and not receive emails – Ruriko Mar 15 '12 at 9:13
Hmmm send only. Can I ask why send only ?? What is the purpose of this configuration? – B14D3 Mar 15 '12 at 9:20
because I only want to send emails for like users requesting password resets, user registration, email verification etc... There's no reason for me to receive email when i use gmail to receive them. – Ruriko Mar 15 '12 at 9:34

If you don't want to receive any emails, then you don't necessarily need postfix. You can just run a mail client configured to use a specified smtp server - for example you can configure the mail command using a .mailrc file.

However, if for some reason you really do need to install Postfix or any other MTA, the easiest way to prevent it receiving mail is to just block incoming traffic on port 25 in iptables:

iptables -A INPUT -s --dport 25 -j DROP

Better than that of course would be to drop traffic to all ports, then only accept the ones you need, leaving port 25 as one of the ones that is closed.

share|improve this answer

What you might be tempted to do is set up some Virtual users. The Virtual users will be validated against a MySQL database to validate they are actually who they say they are. Postfix has some sort of guide on their website, but there are plenty of other guides on google.

Then, you will probably want to configure your Postfix server's SMTPD restrictions. The smtpd(8) daemon determines who can connect to your server, so by telling everyone that isn't you that they can't connect, you should be able to reject any mail, thereby stopping any client not on your network from connecting to the Postfix server.

You will also want to set up a SFP record for each domain you want to send mail from, as (most) email providers will eventually blacklist your website for sending a lot of mail.

share|improve this answer
PLEASE do not advise people to trust random howto's found on the internet! Postfix is a complex piece of software that has excellent - and complete -documentation. – adaptr Mar 15 '12 at 11:34

Your Answer


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.