Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

sendmail: how to masquerade aliased To: address

I have an email header where the recipient sees:
From: HPRS Batch <ohprs@ohprs.org>
To: <benefits@webserver.hprs.local>, <StatenS1@aetna.com>

Open in new window

The local domain name is hprs.local and the ID "benefits" is in the /etc/mail/aliases file routing to various users. The external domain name is ohprs.org. I would like the To: line to read "To: <benefits@ohprs.org" instead of having the local domain name. Obviously, an external recipient would not be able to reply to that address.

in my sendmail.mc file I have

MASQUERADE_AS(`ohprs.org')
FEATURE(`masquerade_envelope')
FEATURE(`masquerade_entire_domain')

so why is this address not getting masqueraded?

Slackware 13.37, kernel 2.6.37.6, sendmail 8.14.4
Avatar of Carl Dula
Carl Dula
Flag of United States of America image

In your sendmail.cf file you will see a DM entry, it should be set like this.

# who I masquerade as (null for no masquerading) (see also $=M)
# DM
DMohprs.org

refresh or restart sendmail

That should solve your problem
Avatar of Mark
Mark

ASKER

carlmd: > In your sendmail.cf file you will see a DM entry, ...

I do have that set as you've shown. Note that the sender is being sent from the same hprs.local domain *is* masqueraded:

From: HPRS Batch <ohprs@ohprs.org>
To: <benefits@webserver.hprs.local>, <StatenS1@aetna.com>

The 1st recipient is in the /etc/aliases/file as:

benefits:       webadmin,user1@ohprs.org,user2@ohprs.org,user3@ohprs.org

The email is *to* those recipients, but instead of To: benefits@ohprs.org it shows  To: benefits@hprs.local. That's the one I want to fix. The mail command in the script is:

 mutt -e 'set content_type="text/html"' -s "subject line"  benefits StatenS1@aetna.com

Any way to fix this?
You can try the following, one at a time. In sendmail.cf set

DJohprs.org

Depending upon your mc options your sendmail.cf may have a section like...

#########################
#   Format of headers   #
#########################

H?P?Return-Path: <$g>
# HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
HReceived: $?sfrom ohprs.org (smtp.ohprs.org [put your ip address here])
        $.$?{auth_type}(authenticated$?{auth_ssf} (${auth_ssf} bits)$.)
        $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
        (using ${tls_version} with cipher ${cipher} (${cipher_bits} bits) verifi
ed ${verify})$.$?u

I changed it to show your ohprs.org so you can try doing that as well.
Avatar of Mark

ASKER

Ah ha! This is apparently not a sendmail thing. When I send to a test alias using mail (mailx) it shows the To: address correctly:

testme@webserver.ohprs.org

When I send using mutt it shows: To: testme@webserver.hprs.local

Odd, because `hostname -f` gives: webserver.ohprs.org. The mutt variation is one of the aliases in /etc/hosts:
192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

Open in new window


I assume, therefore, I need some setting in ~/.muttrc. Do you happen to know what that would be? I'll investigate too.
Avatar of Mark

ASKER

No luck finding a mutt setting to fix this. Any ideas? Is this just something I'll have to live with with mutt?
ASKER CERTIFIED SOLUTION
Avatar of Carl Dula
Carl Dula
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark

ASKER

Thanks, but the problem is the recipient's email, not sender's. Don't know where mutt is getting the webserver.hprs.local domain name other than arbitrarily picking the 2nd alias in the /etc/hosts file:
192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

Open in new window

It does the same thing if I send mail to a real local recipient. Doesn't even have to be an alias name.

Seems odd. This must be fairly common for all mutt users. hostname gives:
$ hostname -f
webserver.ohprs.org

Open in new window

so how is mutt determining the local domain name?
Since mutt is an email client to sendmail, it is obviously overriding the sendmail options, since sendmail does it correctly on it's own.

Have you tried defining mutt aliases in addition to those in sendmail? Look at the section on aliases in:

http://www.mutt.org/doc/manual/manual-3.html

Also try the following...

HOW-TO 3: Send email with a customized sender name and email address
# The .muttrc file is Mutt's configuration file. It's default location is the $HOME directory.
# If you locate it elsewhere, specify its location with the '-F' flag.
# Add the following to the .muttrc file:
set realname="Joe Bloggs"
set from="noreply@jb.com"
set use_from=yes
#
# where:
# realname => Sender's name as it appears in the recipient's mail inbox.
# from => the "reply-to" address
#
Avatar of Mark

ASKER

carlmd: > Have you tried defining mutt aliases in addition to those in sendmail?

I've looked at that, but I think having aliases in both /etc/mail/aliases and mutt aliases might confuse my eventual successor beyond what the inconvenience of fooped recipient addresses presents. Mutt is only used when encoding html in messages -- not often. Other non-interactive mode messages are sent using mail(x).

I've tried switching the order of alias names in /etc/hosts from

192.168.0.3             webserver.ohprs.org webserver.ohprs.local webserver

to

192.168.0.3             webserver.ohprs.local webserver.ohprs.org webserver

thinking mutt was getting the domain from there, but no difference. `hostname -f` gives "webserver.ohprs.org" and the contents of /etc/HOSTNAME is "webserver.ohprs.org".
Avatar of Mark

ASKER

OK, I think I've found a solution. `mutt -D` dumps config settings. This dumps:

hostname="webserver.hprs.local"

The user has no .muttrc to override, but there is a /etc/mutt/Muttrc. Searching that shows not hostname set. I uncommented the hostname setting and made it:

hostname="webserver.ohprs.org"

That finally worked! I have no clue where mutt has been getting webserver.ohprs.local. Even when I removed this alias entirely from the /etc/hosts file it still picked up that FQDN.

I'd be interested if you have a theory on why mutt gets that odd FDQN, other than that, I think my issue is solved.
Not sure if this is the issue, but take a look at:

http://dev.mutt.org/trac/ticket/3298#comment:37

Also, if you google "mutt fqdn" there is a lot to read.