Sendmail "from" is not from the userID sending

On one of my servers (AIX 7.1 sendmail=V10/Berkeley) When I login and sudo su to a serviceID and send a test email, the from header shows as being from my loginID and not the serviceID. I have a second server (AIX 6.1 sendmail=V9/Berkeley) where following the same steps the email head has the service ID as the "from:" info. I have compared the sendmail.cf files for both servers and have attempted to mitigate the differences (setting local host on the V10 server). I also attempted to insert a couple of lines from the V9 file into the V10 file that were not present but sendmail didn't like the older syntax.
code added:

# Added for AIX the next 2 lines
R</C=$+>                $@<@$j.>:/C=$1
R/C=$+<@$+>             $@<@$j.>:/C=$1

There is the "From " envelope (first line) and the "From: " in the header.
Both values should be constructed from the $g macro that should be the effective user ID (where sudo/su switches to):

O UnixFromLine=From $g $d
H?F?From: $?x$x <$g>$|$g$.
2 Likes

Thanks MadeInGermany. Both of my sendmail.cf files have both of those bits of code.

To be clear: the desired behavior is for the email to arrive from the serviceID/appID that was sudo su'd to. Not the human userID sudo su'd from. i.e. if I login as lcarpenter and sudo su - orainst1 and then send an email... the from information in the email should only indicate "orainst1".

How do you send the test mail?
Try this one, with only sendmail and verbose

echo "hello world" | /usr/lib/sendmail -v yourrecipient@youraddress

Any error message?
Any difference in the received mails!