General
cancel
Showing results for 
Search instead for 
Did you mean: 

From user@server.domain to user.server@domain

Alba
Occasional Contributor

From user@server.domain to user.server@domain

Hello,

I've a question and after reading some documentation and other's threads I still can't resolve it.

When I send an e-mail from a server, the field "FROM" shows:

userName@serverName.domain

and I need that the field "FROM" shows:

userName.serverName@domain

Is it posible? I tried to modified the file sendmail.cf but it doesn't work.

What should I change?


Thanks in advance.
4 REPLIES
Steven E. Protter
Exalted Contributor

Re: From user@server.domain to user.server@domain

Shalom,

The mail needs to be built.

I think this script would let you do it:

http://www.hpux.ws/mailfile2

It's got a from field and lets you set it.

If you do a man on mailx you can probably do it from a mailx command line as well.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Doug O'Leary
Honored Contributor

Re: From user@server.domain to user.server@domain

Hey;

There's actually two updates you need to make.

First, configure masquerading. That converts

user@host.domain to user@domain

You'll want to add/update the following lines to the /usr/newconfig/etc/mail/cf/cf/generic-hpux10.mc file:

MASQUERADE_AS(`mydomain.com')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl

The second update is to enable the use of sending user rewrites. That's done through the genericstable:

Add this line to that same file:

FEATURE(`genericstable')dnl

Once done, you'll need to generate a new sendmail.cf file:

cd /usr/newconfig/etc/mail/cf/cf
m4 ../m4/cf.m4 ./generic-hpux10.mc > sendmail.cf
cd /etc/mail
mkdir RCS
echo 'sendmail.cf' | ci -l sendmail.cf
cp /usr/newconfig/etc/mail/cf/cf/sendmail.cf .

Then, stop and restart sendmail.

The genericstable rewrites the sending user name. You'll need

userName@serverName.domain

and I need that the field "FROM" shows:

userName userNmae.serverName

for every user you want to translate.

Once you have that:

cd /etc/mail
chmod 644 generics*
makemap hash genericstable < genericstable
chmod 444 generics*

Please note, if you may not ever receive any replies if your mail relayers won't translate userName.serverName back to username.

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Alba
Occasional Contributor

Re: From user@server.domain to user.server@domain

Thanks a lot Steven and Doug for your answers. I will try them.

VK2COT
Honored Contributor

Re: From user@server.domain to user.server@domain

Hello,

All Mail Transfer Agents (sendmail is one of them) can do it through masquerading or rewritting.

I have done it in Sendmail, Postifx, Exim, Qmail, Smail...

The other replies already gave you recipe
for sendmail.

You can also do it via Mail Processing tools like Procmail (http://www.procmail.org/).

I have done exactly that for a large hospital group where some weird application could
not set outgoing email address correctly and
I had to rewrite it. Basically, here was the
trick:

1. Use Procmail as Mail User Agent in Sendmail;

2. Set up a local Unix account with Procmail
recipes. It does not have to have valid
Shell!

Whenever some email arrives to that
account, Procmail rules intercept it
and change headers any way you want.

Here is one recipe:

:0
* Subject.*whatever
{
:0 fhw
! formail -i"To:user@dom2.dom" -i"From: userName.serverName@domain"
:0
}

What does it do?

When an email with a string "whatever" in
"Subject:" line arrives to local account,
Procmail rewrites it to be sent to
user@dom2.dom as sender
userName.serverName@domain.

As you can guess, the rules are very creative
and you can do myriad of tricks...

Cheers,

VK2COT
VK2COT - Dusan Baljevic