1752394 Members
7038 Online
108788 Solutions
New Discussion юеВ

Re: Mail configuring

 
Daniel Ubeda
Frequent Advisor

Mail configuring

Hi,

I have some linux with sendmail and postfix, and I relay all mails to one exchange server.
I want to receive the linux mails in this format:
root.server1@domain.com.ar
root.server2@domain.com.ar

In this way I can identify the origin of the mails.

Are there any parameter in de sendmail.cf or main.cf to do this ???

thanks
Daniel
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: Mail configuring

The Dj parameter in sendmail.cf should do the job.

Change it to
djroot.server2


save sendmail.cf

service sendmail restart


It could also be done with more effort in the macro file. sendmail.mc Thats a little advanced for this simple request.

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
Steven E. Protter
Exalted Contributor

Re: Mail configuring

Correcting a typo here.

The Dj parameter in sendmail.cf should do the job.

Change it to
Djroot.server2

# Note the lack of spaces between the Dj and the name.

save sendmail.cf

service sendmail restart


It could also be done with more effort in the macro file. sendmail.mc Thats a little advanced for this simple request.

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
Daniel Ubeda
Frequent Advisor

Re: Mail configuring

I put:

Djroot.server1

and the mail say:

from: root@root.server1


I think that is not possible insert any word between the username and the @.

thanks
Daniel
Stuart Browne
Honored Contributor

Re: Mail configuring

So you want to force the "From" user's address?

Is this for *all* mail, or just from a specific process?

if the latter (and it's a root user), you can use the '-f' flag on sendmail to force the from address to be pretty much anything you want.

Otherwise, I'm not sure of a 'nice' way to mangle the 'username' (that's the bit infront of the @) without some serious CF hacking.

You might want to look at your sendmail references for that one.
One long-haired git at your service...
Alexander Chuzhoy
Honored Contributor

Re: Mail configuring

edit /etc/mail/sendmail.mc -find the masquerading rule (quite easy -search for the word masquerade -capital letters) and update this file.
Then issue this command:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Kasper Haitsma
Trusted Contributor

Re: Mail configuring

There are several approaches here. First of all, I can only speak about sendmail, I have no knowledge on postfix.

It seems you want masquerading -> set the DM
DMdomain.com.ar

Now if you want this scenario for all mails from root, add the folowing line in the section starting with "SHdrFromSMTP=31":

SHdrFromSMTP=31
#root masquerading
Rroot<@$w.$m> $@root.$w@$m
Rroot<@$w.$m.> $@root.$w@$m


The ruleset SHdrFromSMTP=31 is from a 8.11.1 sendmail.cf found on hp-ux. I am not sure what version of sendmail is on RH 9, but the rule set is present in RH7.2's 8.11.6

Some more free advise, document, how you built you sendmail.cf, and the modifiations made afterwards. In a next release, it might all change, and it is sometimes very hard to back track the changes made.

HTH
Kasper
It depends