cancel
Showing results for 
Search instead for 
Did you mean: 

Sendmail-one server, 5 domains?

SOLVED
Go to solution
Jared Hamilton_1
Occasional Contributor

Sendmail-one server, 5 domains?

We are running HP-UX 11.00 on one server for five distinct colleges. One of our database products sends e-mail, but the domain that shows is the one of the server. Each school would like for their domain to show whenever one of their users sends e-mail from the software.

Is there any way to get that level of control using sendmail? Ideally, I would like to be able to change the domain name of the sender based on the login of the user (so that if the user logged in is from SchoolA, the message would come from User@SchoolA.edu). Is there any way to configure sendmail to do this? If not, is there anywhere in the mailing process where I can "hook" with a UNIX script to do this?

If I include the line "From: User@SchoolA.edu" at the top of a message, that address appears as the originator. However, I don't have control over the message generation from the level where the database software generates it, so I can't insert this line. If sendmail won't support multiple source domains, is there a way I can "intercept" outgoing messages and modify them by setting/changing the "From" line as I mention above? Thanks in advance for any help.
5 REPLIES
Sanjay_6
Honored Contributor

Re: Sendmail-one server, 5 domains?

Christopher Caldwell
Honored Contributor
Solution

Re: Sendmail-one server, 5 domains?

If your users access your server with a POP client or similar, the POP client handles the setting of the from address.

In addition (the following assumes sendmail 8.8 or >):

The genericstable feature handles mapping of the sender's address. The format is something like

usera newuser@a.com
userb myuers@b.com

The genericstable should be put in /etc/mail/genericstable. It's a dbm style file. Make it with

makemap dbm /etc/mail/genericstable < /etc/mail/genericstable
Jared Hamilton_1
Occasional Contributor

Re: Sendmail-one server, 5 domains?

I've tried to use genericstable but had no luck. Here is what I've done:

1. I created a text file /etc/mail/genericstable:
unix_login someaddress@somedomain.com

2. I ran makemap dbm /etc/mail/genericstable < /etc/mail/genericstable

3. In /etc/mail/sendmail.cf, I removed the comment so that the following line was active:
Kgenerics dbm /etc/mail/genericstable

4. I stopped and restarted sendmail.

I've now seen several references online that say I need to re-make sendmail to support genericstable, but since it was just commented out in sendmail.cf (my step 3 above) I'm not sure if I need to do that.

Also, when I start sendmail, here is what is output:

/etc/mail/aliases: 6 aliases, longest 9 bytes, 76 bytes total
sendmail

Should I see a reference to /etc/mail/genericstable as I do for /etc/mail/aliases? If so, any idea why I'm not seeing it? Thanks again for any help.
Christopher Caldwell
Honored Contributor

Re: Sendmail-one server, 5 domains?

Uncomment the generics rulesets in /etc/mail/sendmail.cf:

#Kgenerics dbm /etc/mail/genericstable
# handle generics database

[...]

#R< $+ > $+ < $* > @ $: < $(generics $1 $: $) > $2 < $3 >
#R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >

Stop sendmail. Start sendmail.
Jared Hamilton_1
Occasional Contributor

Re: Sendmail-one server, 5 domains?

Removing the rest of the "generics" related comments in sendmail.cf did the trick. Thanks for the help!