J
joe
Hi I wrote a function that uses
sendmail -oi -t -f
to send emails. It is currently taking a long time to send many
messages. Is there a way to speed this up?. Here is the code of the
function
sub sendEmail
{
my ($to, $from, $bcc, $subj, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
my $line;
my @rawsender = $from;
open(MAIL, "|$sendmail -oi -t -f $rawsender[0]");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
if (length($bcc) > 0){
print MAIL "Bcc: $bcc \n";
}
$message =~ s/\r/\n/g;
$message =~ s/!\*EMAIL\*!/$to/g;
$message =~ s/\r/\n/g;
my @lines = split("\n", $message);
print MAIL "Subject: $subj\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/html;\n";
print MAIL " charset=\"windows-1252\"\n";
foreach $line (@lines){
print MAIL "$line \n";
}
close(MAIL);
}
sendmail -oi -t -f
to send emails. It is currently taking a long time to send many
messages. Is there a way to speed this up?. Here is the code of the
function
sub sendEmail
{
my ($to, $from, $bcc, $subj, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
my $line;
my @rawsender = $from;
open(MAIL, "|$sendmail -oi -t -f $rawsender[0]");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
if (length($bcc) > 0){
print MAIL "Bcc: $bcc \n";
}
$message =~ s/\r/\n/g;
$message =~ s/!\*EMAIL\*!/$to/g;
$message =~ s/\r/\n/g;
my @lines = split("\n", $message);
print MAIL "Subject: $subj\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: text/html;\n";
print MAIL " charset=\"windows-1252\"\n";
foreach $line (@lines){
print MAIL "$line \n";
}
close(MAIL);
}