# ENVIRONMENT
-* RECIPIENT - the recipient email address, from Postfix
+* ORIGINAL_RECIPIENT - the original recipient email address, from Postfix
* PI_CONFIG - config file. default: ~/.public-inbox/config
* PI_EMERGENCY - emergency destination. default: ~/.public-inbox/emergency/
my $filter = Email::Filter->new(emergency => $emergency);
my $config = PublicInbox::Config->new;
-my $recipient = $ENV{RECIPIENT};
-defined $recipient or die "RECIPIENT not defined in ENV\n";
+my $recipient = $ENV{ORIGINAL_RECIPIENT};
+defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
my $dst = $config->lookup($recipient);
defined $dst or exit(1);
my $main_repo = $dst->{mainrepo} or exit(1);
=begin usage
mkdir -p $HOME/.public-inbox
MAINREPO=/path/to/your/repo.git
- export RECIPIENT='list@example.com'
+ export ORIGINAL_RECIPIENT='list@example.com'
git init --bare $MAINREPO
export GIT_CONFIG=$HOME/.public-inbox/config
- git config publicinbox.$LISTNAME.address $RECIPIENT
+ git config publicinbox.$LISTNAME.address $ORIGINAL_RECIPIENT
git config publicinbox.$LISTNAME.mainrepo $MAINREPO
unset GIT_CONFIG
./import_gmane_spool SLRNPULL_ROOT/news/foo/bar
use IPC::Run qw(run);
sub usage { "Usage:\n".join("",grep(/\t/, `head -n 24 $0`)) }
my $spool = shift @ARGV or die usage();
-defined $ENV{RECIPIENT} or die usage();
+defined $ENV{ORIGINAL_RECIPIENT} or die usage();
my @args = ('public-inbox-mda');
chdir $spool or die "chdir $spool failed: $!\n";
local $ENV{PI_EMERGENCY} = $failbox;
{
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
# ensure successful message delivery
{
{
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
run_with_env({PATH => $main_path}, [$mda], \$in);
}
local $ENV{GIT_DIR} = $maindir;
my $good_rev;
local $ENV{PI_EMERGENCY} = $failbox;
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
my $simple = Email::Simple->new(<<EOF);
From: Me <me\@example.com>
To: You <you\@example.com>
{
local $ENV{PI_EMERGENCY} = $failbox;
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
local $ENV{PATH} = $main_path;
my $mid = 'spam-train@example.com';
my $simple = Email::Simple->new(<<EOF);
{
local $ENV{PI_EMERGENCY} = $failbox;
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
local $ENV{PATH} = $main_path;
my $mid = 'ham-train@example.com';
my $simple = Email::Simple->new(<<EOF);
my $faildir= "$home/faildir/";
local $ENV{PI_EMERGENCY} = $faildir;
local $ENV{HOME} = $home;
- local $ENV{RECIPIENT} = $addr;
+ local $ENV{ORIGINAL_RECIPIENT} = $addr;
local $ENV{PATH} = $fail_path;
my $in = <<EOF;
From: Faildir <faildir\@example.com>
my $f = Email::Filter->new(data => $s->as_string);
ok(PublicInbox::MDA->precheck($f, undef),
- "RECIPIENT unset is OK");
+ "ORIGINAL_RECIPIENT unset is OK");
my $recipient = 'foo@example.com';
ok(!PublicInbox::MDA->precheck($f, $recipient),
- "wrong RECIPIENT rejected");
+ "wrong ORIGINAL_RECIPIENT rejected");
$recipient = 'b@example.com';
ok(PublicInbox::MDA->precheck($f, $recipient),
- "RECIPIENT in To: is OK");
+ "ORIGINAL_RECIPIENT in To: is OK");
$recipient = 'c@example.com';
ok(PublicInbox::MDA->precheck($f, $recipient),
- "RECIPIENT in Cc: is OK");
+ "ORIGINAL_RECIPIENT in Cc: is OK");
}
{