How to Set Up Exim to Forward Mail

centosemailexim

I'm trying to setup Exim on a fresh CentOS install so that it will receive mail for a collection of given addresses, and forward the mail respectively to another address. For example, receiving mail from me@example.com would be forwarded to me@gmail.com.

I figure this should be fairly straight forward… I had this working before with Sendmail, using the virtusertable – is there something similar I can do with Exim?

I'd also like to be able to send mail, but only for mail being sent from the local machine (i.e., from applications running on the server) – I don't need/want a publicly available SMTP server.

Are there any other settings I should bear in mind to make sure the mail server is secure? (i.e., prevent relaying) I'm assuming that it will be secure out of the box.

Thanks.

Best Answer

You will need to use a redirect router. Read the Exim Router specification, as it can do many things and thus can get quite complex.

Basically, you will need to set something up like this (untested)


sender_redirect:
  driver = redirect
  data = ${lookup{$sender_address}lsearch{/etc/exim4/sender_redirects}}

Then create a file in /etc/exim4/sender_redirects that contains the redirects in a line-separated colon-delimited format, like this:


me@example.com: me@gmail.com
Related Topic