I have multiple domains and I want to install postfix to send emails only. How can I do this on ubuntu?
-
What does "send mail only" mean ? – adaptr Mar 15 '12 at 08:59
-
To send emails only and not receive emails – Ruriko Mar 15 '12 at 09:13
-
Hmmm send only. Can I ask why send only ?? What is the purpose of this configuration? – B14D3 Mar 15 '12 at 09: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 09:34
2 Answers
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 0.0.0.0 --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.

- 9,632
- 22
- 81
- 118
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.
-
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