Sendmail - Several local domains delivering to 1 local domain - alias vs. virtusertable
Posted on 2008-10-13
Let's say I own the domains, A.com, B.com, C.com, D.com, E.com and F.com.
Let's also say that our internal networks are listed as Z.local in the internal DNS. Let's also assume that the DNS is perfect... it's not 100% in real life, but the only issues I have are with my ISP and reverse lookups (doesn't affect the mail).
Now, adding to our scenario, let's say that all 6 domains work on the same server. (I just have LOCAL_DOMAIN done for each domain name inside of the sendmail.mc file). The local domain also works by way of the MASQUERADE_AS(A.com).
Now for the fun part. I want to ease the setup involved in adding a user. I use FireTrust's MailWasher server instead of spamassassin because I have to deal with end users who know nothing... they see a button they click it. Thus, I have my mailwasher setup and I have listed the local email address as the main address for each user. Then I added ALL 6 DOMAINS into the list of additional email addresses for each user in MailWasher. THEN, because each of the domains is for a different division in the company (I work in the corporate office, so I have to support essentially 6 different businesses on 1 server... can we say stupid!) anyway... since all 6 domains represent a different division of the company and users are constantly shifting from one company to another to follow a particular project, I have to constantly juggle the domain names/email address combinations to ensure that email comes and goes to an email address at the right domain.
To make it worse, I'm required to setup individual email accounts in thunderbird for each domain... the users want to be able to send under the domain for which they are working at that time.
Sound complicated enough?!? Well that isn't important. What I am looking to do is either put the 6 domains under some virtual domain type setup or possibly under the alias file (is it legal?) so that all users have ONE (1) email address.... their local address. So when an email is received it is brought in and altered so that mailwasher sees the local address, not the particular domain name that was sent to. Also, when an email is sent out, all I have to do is tell the user to select the proper account under thunderbird... even though ALL accounts under thunderbird will be pulling from the local account - they would be separated by what email domain was used for sending.
Hopefully this makes sense. I've already gotten it to work by removing the LOCAL_DOMAIN macros and putting in the virtual domain file macros - and the virual domain file contains a line for each of A-F.com domains. Then, the only local domain left is the Z.local. But the email comes through as it did before... yous end to user@A.com, the user's local account receives an email with the headers saying user@A.com instead of user@Z.local. If I send to user@B.com, I want to see the header say user@Z.com but instead I see user@B.com.
I'm gonna add more detail to this question in case it isn't clear. If you have an alias called "alien" that is an alias for "dude" then you can send email to firstname.lastname@example.org and it will be delivered to "email@example.com". The maillog even states "alien is an alias for dude." I want to do the same thing for the DOMAIN side of the (at) symbol. I want to make an alias for firstname.lastname@example.org called "email@example.com". That way in the maillog I will see "firstname.lastname@example.org is an alias for email@example.com" and when I read the header I will see the email was sent to firstname.lastname@example.org instead of seeing the email@example.com.
I guess I really just want to do to the recipient email address what a router does to an IP packet during NAT translation. I want to see if sendmail can literally alter the header so that the email even goes to the mailwasher milter as the local domain account.
Hopefully that isn't too confusing and I've given enough info. I'm not including my sendmail.mc because as it is right now, it is nothing like I want it to be! So clean slate. Is this sort of "translation" possible... and if so, how do I do it?