Hy, I got several Linux-Servers (running Debian) where different services run: Database-Servers, Webservers, Applicationsservers, Tools and so on. All Servers are connected to the same internal network. There is also one special Server which is the Mail-Server: All Mailaccounts are stored on this server, it is also the outbound Mailserver for all the other servers. I want all Mails for all servers to get saved on the Mailserver. For example if an cron-job fails on one of the web-servers the mail should not be delivered to the local user but instead to the Mailserver so I get a centralized place for mail storage.
How do you set up this scenario?
My current setup is: Using postfix as MTA on the Mailserver and using ssmtp on all the other servers. SSMTP is configured to send the mails to the Mailserver. The Mailserver is configured to allow the whole internal network to relay mails using itself.
Is this the right way to choose? I also thought about setting up a MTA (postfix) on every server and configure it somehow to forward the mails. What would be the advantage of this solution?
For mails being sent to local users on your servers, configure /etc/aliases to send mail out to a different mailbox. If the mailserver is where this mailbox resides, it will be delivered to it and stored there. Any MTA would be fine to send these mails out from the servers.
This seems like a proper setup to me. I personally use Postfix on servers to relay to our central mailserver.