On Tue, Dec 21, 1999 at 11:47:49AM -0700, Philip Gabbert wrote:
> 
> Thank you very much Martin and Dave.. 
> Turns out that I need $EXT2 for forwarding, and the name of my alias
> files was incorrect as well, should have been .qmail-gpsmac-default for
> just .qmail-gpsmac (I presume, I just used the -default)
> 
> One other thing. I want to create a quick perl script to print out all
> the arguments and enviroment valiables that are appearent when
> qmail-send sends the email. This would help me better understand qmail.
> 
> I've created a test email account: [EMAIL PROTECTED], but when I send my
> email to there, it gets lost, and nothing comes out of my script. Here's
> my .qmail-test file:
> 
> |preline /home/guice/tmp/test.pl
> 
> test.pl contains:
> #!/usr/bin/perl
> 
> open (FLE, ">file.text");
> foreach $key (keys  %ENV )
> {   print FLE "$key\t$ENV{$key}\n";  }
> foreach (@ARGV)
> {  print FLE $_ . "\n";  }
> close (FLE);
> exit (0);
> 
> Nothing gets sent to file.text... Any ideas? Or does anybody already
> have a script that will do this for me that I can install. I just want
> something simple, just enough so I can see everything avaliable when
> qmail-send is invoked.
> 
> Thnx again.. 
> 
> Philip
> 
> BTW: tmp is set to 777 and test.pl is set to 755.

Note: The dir doesn't need to be world or group writable as the script is
run as the user owning the dir. 

The script is effectively run in the users home directory; thus ">file.text"
will create a file in the users home directory.

I myself has used this script a few times to do something similar, but at the
same time include the incoming message and return the lot to the sender:
(note that the message body return is xml-parsable as well.

~test/.qmail:
--cut here----------------------------
| /home/guice/tmp/env_echo.pl
--cut here-----------------

env_echo.pl:
----cut here --------------------------
#!/usr/bin/perl
# env_echo.pl [EMAIL PROTECTED] 1999-02-18
use strict;

my $inmail; while (<STDIN>) { $inmail .= <STDIN>; }
my $sender = $ENV{SENDER};
my $modsender = $sender;
#$modsender =~ s/\@/\=/;
my $from = "env\@example.com";

open MAIL,"| /var/qmail/bin/qmail-inject";
print MAIL "From: $from\nTo: $sender\n".
           "Subject: mail environment\n".
           "\n";

print MAIL "<script path=\"$0\"\n";
print MAIL "       current=\"".qx(pwd)."\"/>\n";
foreach (sort keys %ENV)
{
    print MAIL "<env name=\"$_\" value=\"$ENV{$_}\"/>\n";
}

print MAIL "\n\n<incoming>\n$inmail\n</incoming>";

close MAIL;
exit 0;
----cut here --------------------------



cheers, 

   magnus


-- 
http://x42.com/

Reply via email to