routing email question

Hi all,

I just set up a dedicated linode for handling my email for all my domains. However, now I have a problem: If an application on one of my other servers (say apache or cron) wants to send an email, it can't (as far as I know) because it is not on the email server. Is there any way around this? I would like to forward email from these other two servers I have, both running apache, and some running other services to my email server.

Any help is appreciated.

Thanks,

-Michael.

6 Replies

I'd look into some sort of mail proxy to forward the connections via a private Linode IP which the mailserver listens on.

I believe nginx is capable of such, but I'm not sure what else is.. probably even postfix if you configured it right.

You can install mailservers on your other servers that pass all mail to your main mailserver for delivery. How this is configured depends on which MTA you are using.

If you do not want to run mailservers on your other servers, you could also use something like msmtp to send mail to your main mailserver. While this often initially appears simple and attractive, it has disadvantages. If your mailserver is down or not responding, the message will be dropped instead of being queued for future delivery. Also, msmtp does not listen on port 25 for mail - it only accepts mail via standard input, so applications must be designed for that. Third, the web page sending mail will pause until the message is delivered to the main mailserver (or delivery fails), which may take some time if it is busy or down.

Hi,

I am using postfix on my main mailserver, and hope to use postfix on my other servers as well, just for consistancy. Any idea how I could do that with this configuration?

Thanks,

-Michael.

These guides seem to explain how to setup postfix to relay to your mail server..

http://www.howtoforge.com/postfix_relay … mailserver">http://www.howtoforge.com/postfixrelayingthroughanothermailserver

http://www.howtoforge.com/how-to-relay- … fix-server">http://www.howtoforge.com/how-to-relay-email-on-a-postfix-server

Hopefully they are of some help, let us know how it goes.

Those would work, although if you are not running Dovecot or Cyrus on your main mailserver there is another option.

I will call your server with the main mailserver Linode M, and your other servers Linode 1, Linode 2, Linode 3

On Linode M, edit your Postfix main.cf to include:

mynetworks = 127.0.0.0/8, Linode M IP, Linode 1 IP, Linode 2 IP, Linode 3 IP...

This will cause those servers to be considered trusted senders allowed to relay mail.

Set up Linodes 1, 2, 3… as null clients. Edit main.cf on these servers to include:

relayhost = Linode M hostname or IP
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled

This configures these machines to relay all mail through Linode M. You could set myorigin = $mydomain so people won't try to reply to these machines, which don't accept outside mail. However, this can make it more difficult to figure out exactly which machine cron and system messages are coming from.

Note that if you want this mail to be transferred over the private network (assuming all your Linodes are in the same datacenter), you can specify private IP addresses above instead of the public ones.

You may also have to set up a non-local alias (edit /etc/aliases and run newaliases) on Linodes 1, 2, 3… for root so that delivery of cron and system messages isn't attempted locally.

Hi,

That last message works like a charm – Thanks!

-Michael.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct