merlyn@iwarp.intel.com (Randal L. Schwartz) (05/24/91)
I don't seem to see any way to get the Envelope-To and Envelope-From in a PROG mail delivery agent in a stock sendmail with more-or-less standard sendmail.cf's. I've checked the environment and the command line arguments. (No, I don't have quick access to the sources.) (1) is there something I'm overlooking? (2) can I modify the sendmail.cf to stuff them into the environment or passed as a command-line argument without breaking things? If so, what are the standard names for the environment variables? (Or would this be soooo local that it isn't really expected anywhere?) I'm not the first to want these, am I? Just another mail hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/
kyle@uunet.uu.net (Kyle Jones) (05/24/91)
merlyn@iwarp.intel.com (Randal L. Schwartz) writes: > I don't seem to see any way to get the Envelope-To and Envelope-From > in a PROG mail delivery agent in a stock sendmail with more-or-less > standard sendmail.cf's. I've checked the environment and the command > line arguments. (No, I don't have quick access to the sources.) > > (1) is there something I'm overlooking? > > (2) can I modify the sendmail.cf to stuff them into the environment or > passed as a command-line argument without breaking things? If so, > what are the standard names for the environment variables? (Or would > this be soooo local that it isn't really expected anywhere?) Using the environment strikes me as the way to go. With the Bourne shell it's pretty easy to pass the variables in, but getting the right values out of sendmail is another matter. I'd suggest changing A=sh -c $u to A=sh -c 'ENVELOPE_FROM=$g ENVELOPE_TO=??? $u' (untested) I write ??? because I don't know how you'll get the envelope recipient out of sendmail, assuming you want something other than the name of the program that's being run. The name of the program is in $u, of course.
lear@turbo.bio.net (Eliot) (05/24/91)
You can create another mailer to deal with this problem. The envelope-to line can be passed as a command line argument, as it is to /bin/mail or uux. The envelope-from can be passed by adding a mailer flag to include a From_ line. Presumably there are other ways of handling this problem, too, but there is no way to diddle the envp[] from a stock sendmail (at least no documented way). -- Eliot Lear [lear@turbo.bio.net]
rickert@mp.cs.niu.edu (Neil Rickert) (05/24/91)
In article <1991May23.195333.27759@iwarp.intel.com> merlyn@iwarp.intel.com (Randal L. Schwartz) writes: >I don't seem to see any way to get the Envelope-To and Envelope-From >in a PROG mail delivery agent in a stock sendmail with more-or-less >standard sendmail.cf's. I've checked the environment and the command >line arguments. (No, I don't have quick access to the sources.) > >(1) is there something I'm overlooking? It would help if you explained the REAL problem that is causing you to ask this question. When the program mailer gets hold of your message, the envelope sender should be on the unix 'From ' line which will be the first line of standard input. The envelope recipient by now is exactly the name of the program command you are using. You probably should know what that is! My guess is that you wanted the envelope recipient before aliasing. But you can't get that, since the purpose of aliasing is to completely replace the envelope recipient with the alias. However if you control the alias file, you can always put the desired information somewhere into the command line in the alias. More than likely the question arose from a simple problem for which there is a straightforward solution. But you will have to tell us the problem before we can give you the solution. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940
merlyn@iwarp.intel.com (Randal L. Schwartz) (05/24/91)
In article <1991May23.212448.8455@mp.cs.niu.edu>, rickert@mp (Neil Rickert) writes: | In article <1991May23.195333.27759@iwarp.intel.com> merlyn@iwarp.intel.com (Randal L. Schwartz) writes: | >I don't seem to see any way to get the Envelope-To and Envelope-From | >in a PROG mail delivery agent in a stock sendmail with more-or-less | >standard sendmail.cf's. I've checked the environment and the command | >line arguments. (No, I don't have quick access to the sources.) | > | >(1) is there something I'm overlooking? | | It would help if you explained the REAL problem that is causing you to | ask this question. | | When the program mailer gets hold of your message, the envelope sender | should be on the unix 'From ' line which will be the first line of | standard input. The envelope recipient by now is exactly the name of the | program command you are using. You probably should know what that is! | My guess is that you wanted the envelope recipient before aliasing. But | you can't get that, since the purpose of aliasing is to completely replace | the envelope recipient with the alias. However if you control the alias | file, you can always put the desired information somewhere into the | command line in the alias. | | More than likely the question arose from a simple problem for which there | is a straightforward solution. But you will have to tell us the problem | before we can give you the solution. Thanks for all the answers so far. But yours hit the nail on the head. I didn't realize that the envelope-FROM was in the first line. Amazing. That was too simple. Right now, I have a PROG mail agent parsing all the headers to get the "From:" and "Reply-to:" address. However, I hotwired my sendmail.cf in ruleset 0 so that "user.foo" is delivered to "user", via the following declarations (in ease): field something: match(1*); [...] /* remaining names must be local */ /* protect filenames from subfunction interpretation */ if ("/" something) resolve(mailer(local), user("/" $1)); /* allow username.subfunction, ala Andrew */ if (something "." something) resolve(mailer(local), user($1)); /* and the rest... */ if (something) resolve(mailer(local), user($1)); so I can get mail delivered to "merlyn.server" delivered to me. Now, I wanted a quick way to know that the original address was "merlyn.server", without relying on parsing the "to:" and "cc:" addresses (because one of them could have been a system alias that expanded to merlyn.server). But I can see the problem on two counts: (1) yes, after aliasing to the PROG mailer, the "envelope to" really is the name of my program, and (2) from the rule above, "user" is "merlyn", not "merlyn.server". Ugh. So, I'm heading down the wrong dark alley, about to get my throat cut, eh? :-) Sigh. Hmm... can I pass a token via "host" to "local", and use that as an argument in my /bin/sh invocation? I've already hacked it a bit... would hacking it a bit more reek of a bigger kludge (but would it get the job done anyway? :-). Thanks mucho so far. Just another sendmail.cf hacker (but maybe not a very good one :-), -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/
rickert@mp.cs.niu.edu (Neil Rickert) (05/24/91)
In article <1991May24.143629.17892@iwarp.intel.com> merlyn@iwarp.intel.com (Randal L. Schwartz) writes: >Right now, I have a PROG mail agent parsing all the headers to get the >"From:" and "Reply-to:" address. However, I hotwired my sendmail.cf >in ruleset 0 so that "user.foo" is delivered to "user", via the following >declarations (in ease): > >field > something: match(1*); >[...] > /* remaining names must be local */ > /* protect filenames from subfunction interpretation */ > if ("/" something) > resolve(mailer(local), user("/" $1)); > /* allow username.subfunction, ala Andrew */ > if (something "." something) > resolve(mailer(local), user($1)); Basically, at this point you are throwing away information ($2), and it is thereafter lost for good. >so I can get mail delivered to "merlyn.server" delivered to me. Now, Unless you need to deal with large numbers of distinct addresses in this format (user.word) your easiest approach is to just deliver the whole thing to the local mailer - that is, the complete merlyn.server should be the user value. This causes an aliases database lookup. You then can create an aliases entry for 'merlyn.server' which resolves to a specific program, and this will distinguish it from mail just to 'merlyn'. If you have a large number of addresses of the form 'user.word', your other choice is to create your own special purpose mailer to deal with it. If your system grok's shell scripts with '#!', this can be a script. You get to design the argument list yourself. Or check out Chip Salzenberg's 'deliver' package as a very flexible special purpose mailer. It should be available at archive sites. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940