LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (http://www.linuxquestions.org/questions/aix-43/)
-   -   Changing sendmail source address (http://www.linuxquestions.org/questions/aix-43/changing-sendmail-source-address-338032/)

looseCannon 06-28-2005 11:33 AM

Changing sendmail source address
 
Maybe an odd request, but still a legit one.

I need to change the 'from' address for mail coming from some users. I've tried using the 'genericstable' and 'genericsdomain' options. So far nothing is working.

I added the following options to the *.mc file I used to create the sendmail.cf file.

FEATURE(genericstable)dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')

In genericsdomain I listed only the hostname of the server. I created /etc/mail/genericstable.tmp, which contains the following lines:

root someone@somewhere.com
daemon someone@somewhere.com

I used the makemap command create genericstable.db, which is referenced in the sendmail.cf.

Yet, when I send a message from root or daemon the genericstable isn't used. I'm stumped on this and would appreciate any hep someone can lend.

newuser455 06-28-2005 01:08 PM

I am not sure that genericstable is what you want. You need to masquerade the domains. Sorry I cannot really help you any more... I have never done this manually. I have always used Webmin to do it for me... :D

Hope I helped. Good luck.

looseCannon 06-28-2005 01:14 PM

I have masquerading set up for the domains. That was easy enough to get going. But now what I need to do is something similar on a per-user basis.

I found some instructions on how to do this at:
http://www.linuxhomenetworking.com/l...n/sendmail.htm

Look for "Sendmail Masquerading Explained"

Despite following these instructions I still can't get this thing to work.

Very annoying.

newuser455 06-28-2005 01:17 PM

Masquerading will work on a per domain basis. Other than that, I do not know what to tell you. You might try another mail server such as Postfix.

looseCannon 06-30-2005 08:13 AM

Finally got it working, so if anyone else is trying to do the same thing this is what you have to do:

Add the following to your mc file used to generate sendmail.cf:
FEATURE(`genericstable', `dbm /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain`)dnl

Of course you can change the names of the files to be what you want. These are only suggestions.

Regen sendmail.cf
use the m4 command to do this. While in /usr/samples/tcpip/sendmail.cf run the command:
m4 ../m4/cf.m4 your.mc > /tmp/sendmail.cf

Create genericstable
vi /etc/mail/genericstable. Add the users you want to change the email address for. The format is 'user email@domain.com'. The file is tab delimited.

After you have made the file use the makemap command to get it ready for sendmail to use. 'makemap dbm genericstable < genericstable'

Create genericsdomain
Run the following command as root:
sendmail -bt -d0.1 < /dev/null

This will give you an idea of what you need to place in the genericsdomain file. This does not need to have anything done to it, so just leave the file as it is.

Move sendmail.cf into place
Now that everything else is done, move /tmp/sendmail.cf to /etc/mail. Restart sendmail if it is actively running on the system.

YOU'RE DONE!


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