Connect linux VPS to remote mailserver

0

I have linux VPS with some of my unimportant services, but there is no mailserver installed. My mailserver is running on a much more reliable (and expensive) linux server.

In this situation, of course I'm not able to send an email from my VPS (php, cron, etc, the email is just echoed into /var/mail). If I want to send email from here, I had to manually specify the SMTP server. On the server with the mailserver, I don't have to deal with this. The mail just sends. I'm not sure if it's because of the mailserver is installed on this server, or if the guy befory me just configured some global mail setting (is there something like that?).

So, is there any way to make some global setting at the VPS that will tell everything what smtp server to use when sending email, instead of echoing it into /var/mail? Thanks.

Adam Ježek

Posted 2017-10-12T19:53:49.217

Reputation: 51

Answers

0

A properly set up Linux box requires a mail server run on it. This does not need to be a full blown mail server, it can be a minimal server which accepts email on port 25 and relays it all to your primary server.

(I don't like it, but exim is commonly used. I prefer a basic postgres install with a relay. If you go this route you will want to ensure the mail server is firewalled to localhist, and the mail server allows relaying from this IP.)

There is no single place to tell a Linux box to relay mail - except running a mail server. You might be able to get part way there by renaming send mail and creating a wrapper arround it to make it relay, but this will not work universally and will most likely have unintended consequences.

davidgo

Posted 2017-10-12T19:53:49.217

Reputation: 49 152