[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rdgeng::ultrix-mail

Title:Ultrix Mail -- talk to the world!
Notice:Please introduce yourself in note 3
Moderator:FORTY2::BOYES
Created:Mon Jun 27 1988
Last Modified:Wed May 28 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1230
Total number of notes:4591

1228.0. "sendmail - RCPT To: field" by NETRIX::"[email protected]" (Rafael Wariwoda) Wed Feb 19 1997 21:20

Hi,

I have a customer with a specific application recieving mails where 
he has to know the recicipient address of a mail coming in. Normally 
this is the To: field. If the recipient address is aliased the original
address remains in the To: field and it depends on the mailer or
mailsystem if there is a Resent-To: field in the header.

The application has to get the real addressee of the incoming mail. To 
be concrete it has to be the value of the RCPT To: command in the SMTP
protocol.
The application again is called via an alias in the aliases file.
e.g.  appl: |/usr/bin/appl.sh

I tried to configure it in the sendmail.cf file using the $u macro and
putting it in the mail header by inventing a Rcpt: field.
But the value of $u in this case is /usr/bin/appl.sh (the last
on in the chain). What I need is the value that the partner sendmail 
sends when establishing the connection.

Is there any possibility to get the value the RCPT To: field from 
sendmail and to put it in the header?


A second thing I tried to do is to put a regular expression in the
LHS of a rewrite rule. Is it possible to force sendmail to evaluate
a regular expression. e.g. R[^abc]aa.$+         $:$1
I read the sendmail book ( O'Reilly & Ass.) back and forth but could 
not find a hint

Any help is highly appreciated,
Rafael




Here comes part of my sendmail.cf file. I invented a "z" flag to put
the Rcpt: field in the header for local delivered mail and for mails
forwarded to a program.

#############################
###   Format of headers   ###
#############################

H?P?Return-Path: <$g>
#HReceived: by $j; id $i; $b
HReceived: $?sfrom $s $.by $j; ($v/$V)
        id $i; $b
H?D?Resent-Date: $a
H?D?Date: $a
H?F?Resent-From: $q
H?F?From: $q
H?x?Full-Name: $x
HSubject:
H?z?Rcpt: $u
H?M?Resent-Message-Id: <$t.$i@$j>
H?M?Message-Id: <$t.$i@$j>

   .
   .

############################################################
############################################################
#####
#####           Local, POP and Program mailers
#####
############################################################
############################################################

Mlocal, P=/bin/mail, F=lsDFMmnz, S=10, R=20, A=mail -r $f -d $u
Mprog,  P=/bin/sh,   F=lsDFMz,   S=10, R=20, A=sh -c $u
Mpop,   P=/usr/lib/mh/spop, F=nsmFDM, S=10, R=20, A=pop $u



 
[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
1228.1CFSCTC::SMITHTom Smith MRO1-3/D12 dtn 297-4751Thu Feb 20 1997 16:2431
    First, you need to be careful about the headers and macros you invent.
    Custom headers should be "X-<myheader>".
    
    As to your specific problem, if I understand it correctly, I don't know
    of any way to easily capture the pre-aliased recipient name, but I
    wonder if that's really necessary. If I understand you correctly, you
    already have all of the possible recipient names in your aliases file.
    If, instead of:
    
    	aliasname: |/usr/bin/appl.sh
    
    you had:
    
    	aliasname: |/usr/bin/appl.sh aliasname
    
    appl.sh would have the original name available as an environment
    variable ($1).
    
    There are other possibilities, such as defining a new mailer that
    invokes /usr/bin/appl.sh and aliasing as:
    
    	aliasname: aliasname@newmailer
    
    but that seems like the long way around the problem.
    
    On your other question, there is no regular expression parsing in
    sendmail.cf that I know of, but it might be possible to do it using the
    database map capabilities (the K option in combination with new map
    type definitions in the source code).
    
    -Tom
1228.2VAXCPU::michaudJeff Michaud - ObjectBrokerThu Feb 20 1997 17:229
>     	aliasname: |/usr/bin/appl.sh aliasname
>     appl.sh would have the original name available as an environment
>     variable ($1).

	small nit; it would be available via the argument vector (command
	line argument), not as an environment variable (which is a separate
	vector passed to an executable, see execve(2) for more details).

	That said, it's a good idea!