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

how to change sender account before send a message using sendmail

SOLVED
Go to solution

how to change sender account before send a message using sendmail

hi
I need to make the sender from sendmail appears as another user account for example (apps11i@fin01.paltel.ora) to be (apps11i@fin01.paltel.net)


Regards
Burhan Koni
4 REPLIES
Colin Topliss
Esteemed Contributor
Solution

Re: how to change sender account before send a message using sendmail

You need to enable the genericstable feature in Sendmail.

On the host sending the mail, change your sendmail.cf to enable the genericstable feature - look for:

# Generics table (mapping outgoing addresses)
Kgenerics dbm -o /etc/mail/genericstable

in your sendmail.cf

In the /etc/mail directory, create a file called genericstable and in there put your desired address (should all be on one line):
apps11i@fin01.paltel.ora apps11i@fin01.paltel.net

Now create the map:
makemap dbm /etc/mail/genericstable < /etc/mail/genericstable

This will create a map file for use by sendmail.

Stop/restart sendmail, and send a test mail. As long as your host (and you relay maybe if you have internal relaying) can resolve fin01.paltel.net your mail should be deliverd.

Col.
Nicolas Dumeige
Esteemed Contributor

Re: how to change sender account before send a message using sendmail

Make the mail :
cat > /tmp/message.txt
From: bob@kohala.com
Subject: Hello dude
To: nicolas.dumeige@orga.com
[you message]
^D

Send it
cat /tmp/message.txt | /usr/lib/sendmail -t

All different, all Unix
Chris Wilshaw
Honored Contributor

Re: how to change sender account before send a message using sendmail

You can use the sendmail -f option on the command line



From the sendmail man page;

-fname Sets the name of the ``from'' person (i.e., the
sender of the mail) to name. If the user of the -f
option is not a ``trusted'' user (normally root,
daemon, and network) and if the name set using the -f
option and the login name of the person actually
sending the mail are not the same, it results in an
X-Authentication-Warning in the mail header.
Armin Kunaschik
Esteemed Contributor

Re: how to change sender account before send a message using sendmail

Collins answer is a bit incomplete.
Check thread http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=54607
for a complete setup of the genericstable feature.

Alternatively (in scripts) use "sendmail -t" or
mail and build your own mail headers:
/usr/bin/mail recipient.somewhere.com <<_EOF_
From: Faked_From_Address
To: Recipient (may be faked too)
Reply-To: If_necessary
Subject: Some Subject

some data in mail body.
_EOF_

Regards,
Armin
And now for something completely different...