Solved

sendmail: how to masquerade aliased To: address

Posted on 2014-12-02
11
161 Views
Last Modified: 2015-01-08
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
0
Comment
Question by:jmarkfoley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 20

Expert Comment

by:carlmd
ID: 40486902
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
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40487739
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?
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40491241
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.
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 1

Author Comment

by:jmarkfoley
ID: 40498424
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.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40499009
No luck finding a mutt setting to fix this. Any ideas? Is this just something I'll have to live with with mutt?
0
 
LVL 20

Accepted Solution

by:
carlmd earned 500 total points
ID: 40500163
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40500656
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?
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40502389
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
#
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40514357
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".
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40514362
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.
0
 
LVL 20

Expert Comment

by:carlmd
ID: 40516364
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This is my first article on Expert Exchange on the Manual Method of Exporting Office 365 Mailboxes to PST format by using the eDiscovery mechanism of Office. Hope you will enjoy the article.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

751 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