1823058 Members
3071 Online
109645 Solutions
New Discussion юеВ

sendmail configuration

 
SOLVED
Go to solution
Bawitdaba
Frequent Advisor

sendmail configuration

hi everyone!.
I've got a case with a customer about sendmail configuration and i need help.
Cu wants to change the header of the leave out mail as the following example:

-Original mail
from : +34XXXXXXXXX@dominio.com

-Leave out mail
+34XXXXXXXXX@dominio.es

More examples,

from: +52XXXXXXXXXX@dominio.com -> +52XXXXXXXXXX@dominio.mx
from: +56XXXXXXXX@dominio.com -> +56XXXXXXXX@dominio.ch

So, basically cu wants to modify rulesets in sendmail.cf so that the header of the leave out mail changes the domain field depending on the firts two digits of the incoming mail address.

i'm not quite sure if changes in the rulesets are supported so then maybe i can open a WTEC case.
Thanks
Merce
5 REPLIES 5
Christopher Caldwell
Honored Contributor
Solution

Re: sendmail configuration

Use the genericstable to rewrite the From: header of outbound mail

format is
user@oldaddress user@newaddress

grep generic in sendmail.cf:

$ grep generic /etc/mail/sendmail.cf
##### @(#)generic-hpux10.mc 8.3 (Berkeley) 3/23/96 #####
##### @(#)generic.m4 8.3 (Berkeley) 3/24/96 #####
#Kgenerics dbm /etc/mail/genericstable
# handle generics database
#R< $+ > $+ < $* > @ $: < $(generics $1 $: $) > $2 < $3 >
#R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >


uncomment the generics rulesets.

make a text file named /etc/mail/genericstable

to build the dbm file
makemap dbm /etc/mail/genericstable < /etc/mail/genericstable
Bawitdaba
Frequent Advisor

Re: sendmail configuration

hi!
thanks a lot Christopher, but i have to ask you for further explanation.
(my knowledge about sendmail is quite reduced)

so, should i umcomment the four last lines?
how sould i include the rules in the text file?
which one should be the format?
And...after creating the file text, should i genetare the dbm file?

thanks a lot
Berlene Herren
Honored Contributor

Re: sendmail configuration

If your customer is on 11 or 11i then you can download sendmail 8.11.1 from http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=SMAIL811

and use the ./gen_cf to create a sendmail.cf that includes genericstable feature:

Genericstable:

This feature will cause unqualified addresses (i.e., without
a domain) and addresses with a domain listed in class {G}
to be looked up in a map and turned into another ("generic")
form, which can change both the domain name and the user name.
This is similar to the userdb functionality.

The argument of FEATURE(`genericstable\') may be the map
definition; the default map definition is:

hash /etc/mail/genericstable

The key for this table is either the full address, the domain
(with a leading @; the localpart is passed as first argument)
or the unqualified username (tried in the order mentioned);
the value is the new user address. If the new user address
does not include a domain, it will be qualified in the standard
manner, i.e., using or the masquerade name. Note that the
address being looked up must be fully qualified. For local
mail, it is necessary to use FEATURE(`always_add_domain\')
for the addresses to be qualified.
The +detail of an address is passed as %1, so entries like

old+*@foo.org new+%1@example.com
gen+*@foo.org %1@example.com

and other forms are possible.

More information can be found at http://docs.hp.com/hpux/pdf/5969-4305.pdf

Berlene
http://www.mindspring.com/~bkherren/dobes/index.htm
Christopher Caldwell
Honored Contributor

Re: sendmail configuration

Sorry, my grep was too limited

sendmail.cf original -- change

#Kgenerics dbm /etc/mail/genericstable
# handle generics database
#R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark
#R$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark
#R< $+ > $+ < $* > @ $: < $(generics $1 $: $) > $2 < $3 >
#R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >
#R< $* @ $* > $* < $* > $@ $>3 $1 @ $2 found qualified
#R< $+ > $* < $* > $: $>3 $1 @ *LOCAL* found unqualified
#R< > $* $: $1 not found

to

Kgenerics dbm /etc/mail/genericstable
# handle generics database
R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark
R$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark
R< $+ > $+ < $* > @ $: < $(generics $1 $: $) > $2 < $3 >
R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >
R< $* @ $* > $* < $* > $@ $>3 $1 @ $2 found qualified
R< $+ > $* < $* > $: $>3 $1 @ *LOCAL* found unqualified
R< > $* $: $1 not found



With sendmail configs, the "table" files are real picky about format, but we use
entry[tab][tab]otherentry
one map per line.

Once you've built /etc/mail/genericstable

with makemap

makemap dbm /etc/mail/genericstable < /etc/mail/genericstable

And you've uncommented the rulesets, restart sendmail.

# /sbin/init.d/sendmail stop
# /sbin/init.d/sendmail start; tail -f /var/adm/syslog/mail.log

(The tail is to make sure you don't have a config typo somewhere - if sendmail is bummed it'll tell you in the tail - ^C to stop).

In the future, when modifying the genericstable, you don't have to restart sendmail. Just make the changes in /etc/mail/genericstable and use makemap.


Christopher Caldwell
Honored Contributor

Re: sendmail configuration

Doh! I'm sorry. My post should have read

With sendmail configs, the "table" files are [NOT] real picky about format

i.e. spaces or tabs (a reasonable number) work