开发者

Catchall Router on Exim does not work

I have setup a catchall router on exim (used as last router):

catchall:
  driver = redirect
  domains = +local_domains
  data = ${lookup{*@$domain}lsearch{/etc/aliases}}
  retry_use_local_part

This works perfectly when sending emails locally. However, if I login to my GMail account开发者_如何学编程 and send an email to whatever@mydomain.com, then I get an "Unrouteable Address".

Thank you for any hints to solve this issue.


In the system_aliases: section of the config file you already have a section which does the lookup in /etc/aliases.

Replace

data = ${lookup{$local_part}lsearch{/etc/aliases}}

with

data = ${lookup{$local_part}lsearch*@{/etc/aliases}}

and make sure you have *:catchall_username* in /etc/aliases

This works great for a single domain mail server which is already using /etc/aliases


For this router to work, make sure that

  1. mydomain.com is in local_domains
  2. there is an entry for *@mydomain.com in /etc/aliases
  3. MX record for mydomain.com is pointing to the server, where you've configured this


This is old as heck, but I didn't see a good answer posted and someone else might want to know the answer.

This post is geared towards Debian with in single configuration file mode. It should work on any Linux Exim4 install though. For the purpose of explaining things we’ll use test@example.com which is configured with the hostname mail.example.com. The system will have a real user called test and we want to create an alias for test called alias. So the end result will all email sent to alias@example.com forwarded to test@example.com without having to create the user alias on the system.

First we need to create a place to store all of the alias files:

mkdir /etc/exim/aliases.d

vim /etc/exim/aliases.d/mail.example.com

contents of the alias file for mail.example.com alias:test

vim /etc/exim/exim4.conf.template

Now look for the section system_aliases. Here you’ll see data = ${lookup{$local_part}lsearch{/etc/aliases}} or something similar. Change that to

data = ${lookup{$local_part}lsearch{/etc/exim4/aliases.d/$domain}}

Save the file and restart exim. The alias should now work. To add support for other domains just add more alias files in the aliases.d directory with the correct hostname.

I copied and pasted this from my blog:

0xeb.info

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜