I'm trying to set up sendmail to forward all email to **@ **.crm.mycompany.com to email@example.com. Unfortunately my sendmail-fu isn't up to it and I can't find anything useful on Google.
My plan was to use an existing internal Linux server (CentOS 5), port-forward SMTP traffic from one of our spare external IPs to it and set up a wildcard MX record to point to that external IP. However I haven't managed to make sendmail work with this.
I have managed to get the non-wildcard case working, e.g. by adding test.crm.mycompany.com to /etc/mail/local-host-names and adding a "@test.crm.mycompany.com" line to virtusertable. However I can't see how to do the wildcard case. These files don't seem to accept wildcards in the domain names and as far as I can see the only configuration that can manage wildcard DNS is the relay_entire_domain. However if I configure my test domain for relay then it ignores the virtusertable and procmail and just tries to relay the email on - so unless I can trigger either of those for relay emails I don't think I can manage this anyway. And a final wrinkle here is that I can't seem to set $=m to mycompany.com - it's always our internal domain name (the hostname is server.internal.lan and $=m is internal.lan) and DOMAIN(mycompany.com)dnl in sendmail.mc tries to include a file from /usr/share (?).
Is what I'm trying to do possible? I was hoping to reuse an internal server for this - do I need to put a server outside the firewall or in the DMZ instead? Would this be easier with postfix or something else instead?
Thanks for any suggestions!