0

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

Ruriko
  • 105
  • 1
  • 4

2 Answers2

1

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.

dunxd
  • 9,632
  • 22
  • 81
  • 118
0

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.

adaptr
  • 16,576
  • 23
  • 34
qweet
  • 731
  • 5
  • 11
  • 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