[ic] remove sendmail 5-sec pause?
Mike Heins
mike at perusion.com
Fri Jul 2 12:08:51 EDT 2004
Quoting Jack Cushman (jc at alexinteractive.com):
> Hi --
>
> I'm trying to shave seconds off final order processing on a busy site.
> I've found that, about one in ten times, etc/mail_receipt takes an
> extra five seconds to run. Debugging messages narrow down the extra
> time to the point of sending the email:
>
> [email to="[scratch to_email], __MAIL_RECEIPT_CC__"
> subject="__COMPANY__ Order #[value mv_order_number]: [scratch
> subject_end]"
> from=|"__COMPANY__ Order Confirmation" <orders at company.com>| ]
> ... email contents ...
> # pause comes after this
> [/email]
> #but before this
>
> I'm not sure exactly what config values apply here, but I believe we
> have all defaults set as far as sending mail goes. So -- how can I kill
> this pause? Is it something changing sendmail options could fix? Or is
> it possible to have IC execution continue without waiting for the
> results of the [email] tag?
You could do your own custom sendmail script that accepted the message
on standard input then called sendmail itself in the background. It
would not be too difficult, here is a five-minute effort:
#!/usr/bin/perl
use File::Temp;
my $basedir = '/tmp/sendmail';
my $sendmail = '/usr/sbin/sendmail -t';
umask 2;
mkdir $basedir unless -d $basedir;
my $tmp = File::Temp->new( DIR => $basedir );
my $tmpnam = $tmp->filename;
open OUT, "> $tmpnam"
or die "Cannot create $tmpnam: $!\n";
my $cmdline = join " ", $sendmail, '<', $tmpnam, '&';
while(<>) {
print OUT $_;
}
close OUT;
system($cmdline);
if($?) {
die "Failed to fork sendmail: $!\n";
}
Of course you would change the directive SendMailProgram to call that
script.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman
More information about the interchange-users
mailing list