LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 09-17-2014, 01:03 PM   #1
unix1adm
Member
 
Registered: Oct 2008
Posts: 688

Rep: Reputation: 32
sendmail : changing from addr and reply addr


I have been googling the heck out of this but still cannot get anything to work.

env: AIX 6.8

My user has an application that emails but ti comes form root@servername.domain.com

They want the FROM and the reply to look like an exchange address so if someone replies to the email it will go back to a generic exchange inbox. Not the AIX server.

From : MY_app@comain.com
reply: my_app@domain.com


Do I need to modify the sendmail.cf or can this be done with a script so its not set on a global system setting?

If it has to be done in sendmail.cf what do I need to change? I dont see some of the settings like DM or CE in my sendmail.cf file as some other posts I looked at refer to.

If its better to use a script the syntax would be great.

I tried :

echo "testing" | sendmail -f "me@me.com" me@me.com </dev/null

The -f option did not work for me. I never got the email.

I also tried mailx -r me@me.com -s "test" me@me.com </dev/null
 
Old 09-17-2014, 01:12 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by unix1adm View Post
I have been googling the heck out of this but still cannot get anything to work.
env: AIX 6.8

My user has an application that emails but ti comes form root@servername.domain.com They want the FROM and the reply to look like an exchange address so if someone replies to the email it will go back to a generic exchange inbox. Not the AIX server.

From : MY_app@comain.com
reply: my_app@domain.com

Do I need to modify the sendmail.cf or can this be done with a script so its not set on a global system setting? If it has to be done in sendmail.cf what do I need to change? I dont see some of the settings like DM or CE in my sendmail.cf file as some other posts I looked at refer to. If its better to use a script the syntax would be great.

I tried : echo "testing" | sendmail -f "me@me.com" me@me.com </dev/null

The -f option did not work for me. I never got the email.

I also tried mailx -r me@me.com -s "test" me@me.com </dev/null
You need to use the genericstable:
http://www.sendmail.com/sm/open_sour...#genericstable
https://www.madboa.com/geek/sendmail-genericstable/
 
Old 09-17-2014, 01:27 PM   #3
unix1adm
Member
 
Registered: Oct 2008
Posts: 688

Original Poster
Rep: Reputation: 32
The other thing i forgot to mention is it is the root user so we would like to keep it at the app/script level is possible so we do not lose the root mail going to a separate exchange inbox for the admins.

Also I noticed i do not have a sendmail.mc file in the dir. Nothing on the system by that name.
 
Old 09-18-2014, 10:13 AM   #4
wingnut64
Member
 
Registered: Sep 2004
Distribution: AIX, RHEL, Ubuntu
Posts: 51

Rep: Reputation: 23
You can use the '-r' flag to change the reply to address without modifying any config files.

print "Hello" | mail -r "my_app@example.com" -s "Subj" recipient@example.com
 
1 members found this post helpful.
Old 09-22-2014, 12:17 PM   #5
unix1adm
Member
 
Registered: Oct 2008
Posts: 688

Original Poster
Rep: Reputation: 32
So this is what i found out. Hope this can help someone else.

How to enable sendmail masquerading on sendmail 8.14 and later

1) Back up current sendmail.cf file
# cd /etc/mail
# cp sendmail.cf sendmail.cf.<date>

Then, edit the sendmail.cf file as follows:

2) Set the DM macro to the preferred domain, ie:
DMmydomain.com
-- This is the domain that will appear for the sender's email address,
user@mydomain.com

3) Remove root from C{E} macro if desired
By default, you have this C{E} macro in sendmail.cf
C{E}root
The above entry means to NOT masquerade the root user.
If you want to also masq. root user, then change it to this:
C{E}

4) Find Ruleset 93 and 94 in sendmail.cf file and edit them to look exactly as shown below.
Important: Replace <TAB> with actual TAB character!

###################################################################
### Ruleset 93 -- convert header names to masqueraded form ###
###################################################################

SMasqHdr=93

# handle generics database
#R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark
#R$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark
#R< $+ > $+ < $* > @ $: < $(generics $1 $: @ $1 $) > $2 < $3 >
#R<@$+ + $* @ $+> $+ < @ $+ >
# $: < $(generics $1+*@$3 $@ $2 $:@$1 + $2@$3 $) > $4 < @ $5 >
#R<@$+ + $* @ $+> $+ < @ $+ >
# $: < $(generics $1@$3 $: $) > $4 < @ $5 >
#R<@$+ > $+ < @ $+ > $: < > $2 < @ $3 >
#R< > $+ < @ $+ . > $: < $(generics @$2 $@ $1 $: $) > $1 < @ $2 . >
#R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >
#R< > $+ + $* < @ $+ > $: < $(generics $1+* $@ $2 $: $) > $1 + $2 < @ $3 >
#R< > $+ + $* < @ $+ > $: < $(generics $1 $: $) > $1 + $2 < @ $3 >
#R< $* @ $* > $* < $* > $@ $>canonify $1 @ $2 found qualified
#R< $+ > $* < $* > $: $>canonify $1 @ *LOCAL* found unqualified
#R< > $* $: $1 not found

# do not masquerade anything in class N
R$* < @ $* $=N . ><TAB>$@ $1 < @ $2 $3 . >

#R$* < @ *LOCAL* > $@ $1 < @ $j . >

# special case the users that should be exposed
R$=E < @ *LOCAL* > <TAB>$@ $1 < @ $j . >
R$=E < @ $=M . > <TAB>$@ $1 < @ $2 . >
R$=E < @ $=w . > <TAB>$@ $1 < @ $2 . >

# handle domain-specific masquerading
R$* < @ $=M . > $* <TAB>$: $1 < @ $2 . @ $M > $3
R$* < @ $=w . > $* <TAB>$: $1 < @ $2 . @ $M > $3
R$* < @ *LOCAL* > $* <TAB>$: $1 < @ $j . @ $M > $2
R$* < @ $+ @ > $* <TAB>$: $1 < @ $2 > $3
R$* < @ $+ @ $+ > $* <TAB>$: $1 < @ $3 . > $4

###################################################################
### Ruleset 94 -- convert envelope names to masqueraded form<TAB>###
###################################################################

SMasqEnv=94
#R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
R$+<TAB><TAB><TAB>$@ $>93 $1

5) Refresh sendmail (if sendmail is running)
# refresh -s sendmail

6) Try to send a test email to confirm that masquerading is working
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] IP addr Huamin Linux - Software 9 05-08-2012 09:00 PM
Unique ID of machine, other than IP-Addr/MAC-Addr to prevent spoofing anupamsaxena Linux - Security 9 12-20-2009 10:58 PM
Obtain IP addr. from MAC addr? Ryand833 Linux - Wireless Networking 3 06-30-2005 01:59 PM
Help, IP Addr. dolvmin Linux - Networking 3 01-23-2004 08:58 PM
ip addr but cant ping montgomeryi Linux - Networking 0 08-24-2003 11:22 AM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration