[ic] Setting email sender address

Josh Lavin josh at perusion.com
Tue Mar 31 16:42:59 UTC 2015


Quoting Bob Puff (bob at nleaudio.com):
> I have a few different websites running IC on the same server.  When someone
> enters an email address at checkout that is invalid, as the hostmaster, I see
> the bounce.  I would like to have IC set the email envelope sender for each
> catalog, so that bounces go to the appropriate admin for their respective
> catalogs (instead of just going to root, or the interch user).

When I use sendmail, I put the catalog owner in "trusted-users"
(/etc/mail/trusted-users on CentOS), and then in catalog.cfg:

SendMailProgram /usr/local/bin/sendmail_bg -f __EMAIL_INFO__

sendmail_bg is a script that just forks sendmail in the background. Here
is mine:

----

#!/usr/bin/perl

use File::Temp;

my $basedir = "/tmp/sendmail-$ENV{'USER'}";
my $sendmail = '/usr/sbin/sendmail';
my @opts;
for(@ARGV) {
        push @opts, $_;
}
for(@opts) { shift(@ARGV) }
my $opt = join ' ', @opts;

umask 2;

mkdir $basedir unless -d $basedir;

my $tmp = File::Temp->new( DIR => $basedir );
$tmp->unlink_on_destroy(0);

my $tmpnam = $tmp->filename;

open OUT, "> $tmpnam"
        or die "Cannot create $tmpnam: $!\n";

my $cmdline = join " ", $sendmail, $opt, '<', $tmpnam, '&';

while(<>) {
        print OUT $_;
}

close OUT;

system($cmdline);

if($?) {
        die "Failed to fork sendmail: $!\n"
}


-- 
Josh Lavin
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
... ask me about job opportunities ...



More information about the interchange-users mailing list