Solved

Rewrite envelope recipient for non-local mail

Posted on 2006-06-16
8
2,015 Views
Last Modified: 2013-12-17
This seems like it should be an easy question, but I've been looking for a while and haven't had much luck.

I'd like to rewrite the recipient for particular addresses (not domain-wide) that goes through my sendmail box.  Basically, I want the same type of functionality that aliases provides but for non-local accounts.  Is it possible to do this?  If so, what do I need to do to get it set up.

For example, the machine mail.xyz.com is a relay for the domain abc.com.  I want any email sent to joe.user@abc.com that goes through that box to end up at joe.user@gmail.com.  But, I want it specific for just joe.user@abc.com... email sent to jill.user@abc.com should go through as normal.

I've got this entry in virtusertable:

      joe.user@abc.com    joe.user@gmail.com

And it has no effect, I'm guessing because abc.com is an entry in relay-domain and in mailertable.  I don't want to (and can't) use virtusertable to map the entire domain to something else to get rid of the relay entry:

   @abc.com  to   @internal.abc.com

Because the end box mail.abc.com (an Exchange 5.5 box internal to our network) isn't set up to handle addressing that way and that isn't open to change for the minor problem of forwarding email for a few users.  The Exchange box also answers the question why I don't simply add an alias on the local server to forward the mail once it ultimately gets home--  Exchange doesn't support aliases.
0
Comment
Question by:clockwatcher
  • 5
  • 2
8 Comments
 
LVL 34

Expert Comment

by:PsiCop
ID: 16924754
You probably need to use the genericstable functionality. See this PAQ --> http://www.experts-exchange.com/Networking/Email_Groupware/Sendmail/Q_21322113.html
0
 
LVL 25

Author Comment

by:clockwatcher
ID: 16925304
I looked into it earlier and everything I found regarding it (including the link you posted) seems to indicate it rewrites the from (sender).  I need to rewrite the recipient.   Does it work for either?
0
 
LVL 34

Assisted Solution

by:PsiCop
PsiCop earned 250 total points
ID: 16926761
Whoops! Misread your Question.

Aliases doesn't work because the aliases table is not consulted for non-local E-Mail. Only virtusertable and mailertable are consulted, in that order.

Virtusertable is the solution. I'm not sure why it's not working for you. You do have a virtuserdomains file, right? Similar to genericstable, if a Domain is not listed in the virtuserdomain file, then virtusertable won't be consulted for E-Mail headed to that Domain.
0
 
LVL 6

Accepted Solution

by:
anfi earned 250 total points
ID: 16926951
Virtusertable works only for local email domains ($=w) and domains listed in $={VirtHost}
Mailertable DOES NOT work for local email domains ($=w).

To make your virtusetrtable work add abc.com to $={VirtHost} list of domains.

1) Add the following lines to your *.mc file:

LOCAL_CONFIG
F{VirtHost}/etc/mail/virtual-domains

2) create /etc/mail/virtual-domains with the following content

abc.com


Sendmail.org offers custom macros for manipulating $={VirtHost} but read about side effects before deploying them.
0
Do email signature updates give you a headache?

Constantly trying to correctly format email signatures? Spending all of your time at every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

 
LVL 25

Author Comment

by:clockwatcher
ID: 16927147

But, abc.com isn't local (virtual or not) and I don't want it to be.   I need the email to be relayed on to the real server and I can't rewrite it to something like downstream.abc.com because the box that's downstream can't be modified (not under my control) to accept addresses like that.
0
 
LVL 25

Author Comment

by:clockwatcher
ID: 16927163

This box is a MailScanner.  It sits outside our firewall, intercepts and then forwards email destined for our real server (an exchange box) to it.  The MX record for our domain points to it.  It then uses mailertable with a forced IP to relay the email into our real box.

mailtertable
--------------
abc.com    smtp:[aaa.bbb.ccc.ddd]

I don't believe I can set up a virtual domain because I need the email forwarded on with the domain name left untouched to the home server.   Can someone explain how I can get that to work with virtusertable?

It really looks like it'd be easy to add with a custom rewrite LOCAL_RULE_0 but I'm not sure if I really want to mess with raw rewrite rules.
0
 
LVL 25

Author Comment

by:clockwatcher
ID: 16927195
I'm probably just misunderstanding it and I can add an entry for abc.com to virtual-domain and be fine.  But, before I do that I just want to be 100% sure that abc.com will still end up being handled by mailertable.  We get a lot of email and I don't have a test box to play with this... I'd prefer not to get chewed a new one for bringing down the mail system for our entire company (even for the fifteen minutes or so it takes to test it) just to forward email for a few pain in the ass users (no matter how important they are).
0
 
LVL 25

Author Comment

by:clockwatcher
ID: 16927822
Okay... I registered a test domain to run through that server and added a VIRTUAL_DOMAIN macro to my config file.  Everything's working great.   The addresses I don't have in virtusertable get relayed correctly and the ones I do have in there get forwarded over to gmail.

For whatever reason I can't get a message sent from my gmail account to a virtuser address that maps back to the sending gmail account.  Sent from a different gmail account to the forwarded address ends up getting forwarded fine.  They'll just have to live without being able to send email from their gmail accounts to their own address here and expecting to have it forwarded back to them.  Not gonna rewrite the from just to take care of that.

Thank you both very much for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Nearly six years ago I was hired by a company to be their senior server engineer. One of my first projects was to implement Exchange Server 2007 on a Windows Server 2008 Single Copy Cluster for high availability. That was the easy part; read on to l…
Resolve DNS query failed errors for Exchange
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now