Email wildcard subdomain using Exim

I want to process all emails sent to @.example.com (that is any subdomain of example.com) to a PHP script using EXIM. Is this possible and can someone show me a tutorial/clue related to this one.

I'm creating a SaaS apps that create subdomain.example.com to a user with and email *@subdomain.example.com with it.

I've already setup the wildcard dns for domain and mx *.example.com. 14400 IN A 202.190.178.56 mail 14400 IN A 202.190.178.56 *.example.com. 14400 IN MX 10 mail

I hope can receive some example or clue to the right direction.


There are some addresses you should exempt such as postmaster, abuse, hostmaster, and any other administrative addresses. I would recommend you pick a domain or two that will be used for email rather than wildcarding the domain.

  • Configure local_domains to include *.example.com, or a specific list of domains.
  • Enable wildcard aliases and configure an wildcard alias to and local part which will run your process. Add a router to handle this id and direct it to a new transport. Add the new transport to run your program.
  • Test and release

You will likely need to configure the transport to run as a specific user.