Solved

How to keep virtual domain name on outgoing sendmail

Posted on 2013-11-29
6
304 Views
Last Modified: 2014-03-14
I have a host with multiple domain names: thishost.com, thathost.com. My sendmail.mc file has:

MASQUERADE_AS(`thishost.com')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')

I originally had this setting before adding thathost.com, mainly to prevent the hostname from showing up in the From:  address. e.g. myuser@thishost.com instead of myuser@server.thishost.com.  However, when I added thathost.com to /etc/mail/local-host-names and the line

thisuser@thathost.com          thisuser

to the /etc/virtusertable, I cannot send mail addressed from users on thathost.com. The domain always gets changed to thishost.com. E.g. a message sent by thatuser@thathost.com gets sent as From: thatuser@thishost.com.

I suspect the way to fix this is to remove the MASQUERADE_AS directives in sendmail.mc, but I'd like some confirmation from a expert before I start experimenting.
0
Comment
Question by:jmarkfoley
6 Comments
 
LVL 19

Expert Comment

by:xterm
Comment Utility
How are you sending the mail?  You should be able to set the return-path with the -f flag to sendmail, and configure any From address you want.
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
This only affects emails sent from the shell?  Look at configuring the email client settings to use a
0
 
LVL 1

Author Comment

by:jmarkfoley
Comment Utility
xterm: > You should be able to set the return-path with the -f flag to sendmail, and configure any From address you want.

My email client is mailx 12.4. The option to do what you are describing is -r which sets the From address. That used to work just fine to set whatever address I wanted as the Reply-To:. Since setting /etc/virtusertable and /etc/local-host-names it will set the username part of the address, but always overrides what I specify as the domain. mailx also let's me specifically set From:, Reply-To: and Sender: The domains on all of these settings get overridden.

Arnold:  > Look at configuring the email client settings

Did that, and have had those set and working for years. With mailx you use the -A <account> parameter which looks up e.g.

account mercurey {
    set from="myuser@thathost.com (Mark Foley)"
    set hostname=thathost.com
    set ORGANIZATION="Mercurey Technologies SA, Limited"
}

in the $HOME/,mailrc file. Again, this has always worked until I set the virtusertable and local-host-names.

So, I don't think this is something I can fix from the mail client. I could remove the settings in virtusertable and/or local-host-names, but then this host won't be able to receive mail for thathost.com.

I could remove the MASQUERADE directive in sendmail.mc, but then I'll have the machine name attached to the domain name in the messages.

I'm sure I have some sendmail configuration wrong. Computers host email for multiple domains all the time. I've just never set this up before.

I'm in a quandary!
0
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!

 
LVL 76

Assisted Solution

by:arnold
arnold earned 250 total points
Comment Utility
I think there are two masquerade, one that masks the name of the server which seems to be what you are looking to do. the other deals with masquerading the sender which seems to be what you have configured.
i.e. user@domain will be converted to user@anotherdomain

not sure why/what the issue you have not reflecting the true name of the server?

the other deals with when the sender is identified as username only, the mydomain will be appended to it.


I prefer other mail server to sendmail.
The following covers the different variations and options.
http://www.sendmail.com/sm/open_source/docs/m4/masquerading.html
0
 
LVL 1

Author Comment

by:jmarkfoley
Comment Utility
I've tried two things, both of which appear to have worked:

1) I removed all MASQUERADE directives in sendmail.mc and put in $HOME/.mailrc e.g.

account thatDomain {
    set from="user@thathost.com (My Name)"
    set hostname=thathost.com
    set ORGANIZATION="Mercurey Technologies SA, Limited"
}

for each account I want to use. The "set from" seems to do the trick. I don't see that the "set hostname" does much.

2) I kept MASQUERADE_AS in sendmail.mc, removed FEATURE(`masquerade_envelope')
(not sure why I had that one set in the first place) and FEATURE(`masquerade_entire_domain'). I then added MASQUERADE_EXCEPTION(`thathost.com')

Both of these seem to work. Probably method 1 is more desirable because I'd have to set a MASQUERADE_EXCEPTION for each domain hosted.

I suppose if I multi-home a dozen different domains I'll have to have the appropriate "set from" in each user's .mailrc file.

Is this the normal way multi-homed hosts set up their email users? Seems highly dependent on the mail client used.
0
 
LVL 13

Accepted Solution

by:
Sandy earned 250 total points
Comment Utility
yes, method 1 is suggested one.. Not exactly highly dependent on the mail client  used but it requires basic headers value to be filled.

TY/SA
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Easy CSR creation in Exchange 2007,2010 and 2013
To show how to create a transport rule 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 >> Rules tab.:  To cr…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

772 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

9 Experts available now in Live!

Get 1:1 Help Now