I have multiple domains and I want to install postfix to send emails only. How can I do this on ubuntu?
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:
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.
What you might be tempted to do is set up some
Then, you will probably want to configure your Postfix server's
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.