#!/usr/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%0D%0A/|/g; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($in{$name}) { $in{$name} = $in{$name}.",".$value; } else { $in{$name} = $value; } } $in{'txt_message'} =~ s/\|/%0D%0A/g; $in{'txt_message'} =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $text_message = $in{'txt_message'}; $in{'html_message'} =~ s/\|/%0D%0A/g; $in{'html_message'} =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $html_message = $in{'html_message'}; $totalEmails = $in{'rightrange'} - $in{'leftrange'} + 1; $time_start = time() + $in{'time_diff'}*3600; $lock = "2"; $pid = fork(); print "Content-type: text/html \n\n fork failed: $!" unless defined $pid; if ($pid) { print "Content-type: text/html \n\n"; print "List Administration


Congratulations!
The mailing has been started. You will receive a confirmation e-mail when the mailing has been completed.

"; exit(0); } else { close (STDOUT); $count = 0; open(LIST,"$in{'list_dir'}/$in{'list'}/$in{'list'}.txt"); if ($lock){flock(LIST, $lock);} @addresses=; close(LIST); $text_message =~ s/(.{60}\s)/$1\n/g; my @boundaryv = (0..9, 'A'..'F'); srand(time ^ $$); for (my $i = 0; $i++ < 24;) { $boundary .= $boundaryv[rand(@boundaryv)]; } ############# my $htmlhead =<
---------------------------------------------------------------------
HTML remove... ---------------------------------------------------------------------

EOHTMLREMOVE print MAIL "From: $in{'adminMail'}\n"; print MAIL "To: $member\n"; print MAIL "Subject: $in{'subject'}\n"; my $msg = ''; $msg .= $htmlhead if $in{'type'} eq "html"; $msg .= $texthead if $in{'type'} eq "textpart"; $msg .= $multihead if $in{'type'} eq "multipart"; unless($in{'type'} eq 'html') { $msg .= "$text_message\n\n"; $msg .= $textremove if $in{'remove_notice'} eq "1"; } $msg .= $multipart if $in{'type'} eq "multipart"; unless($in{'type'} eq 'text') { $msg .= "$html_message\n"; $msg .= $htmlremove if $in{'remove_notice'} eq "1"; } print MAIL $msg; if (int($count/100)*100 == $count) { $time_now = time() + $in{'time_diff'}*3600; open(LOG, ">$in{'list_dir'}/$in{'list'}/log_sent.txt"); if ($lock){flock(LOG, $lock);} $status = $count - $in{'leftrange'} + 1; print LOG "$time_start" . "::" . "$totalEmails" . "::" . "$status" . "::" . "$time_now"; close(LOG); } close MAIL; } } $time_now = time() + $in{'time_diff'}*3600; open(LOG, ">$in{'list_dir'}/$in{'list'}/log_sent.txt"); if ($lock){flock(LOG, $lock);} print LOG "$time_start" . "::" . "$totalEmails" . "::" . "$count" . "::" . "$time_now" . "::end"; close(LOG); open (MAIL, "|$in{'mailprog'} -t"); print MAIL "From: $in{'adminMail'}\n"; print MAIL "To: $in{'adminMail'}\n"; print MAIL "Subject: Congratulations!\n\n"; print MAIL "Congratulations!\nThe mailing was successfully sent to $totalEmails people by $ENV{'REMOTE_ADDR'}.\nMailing started at $time_start and ended at $time_now.\nHere is what was sent:\n\n-----\n\n"; print MAIL "Type - $in{'type'}\n\n"; print MAIL "Subject: $in{'subject'}\n\n"; if ($in{'type'} eq 'html') { print MAIL "$in{'html_message'}\n\n-----"; } else { print MAIL "$in{'text_message'}\n\n-----"; } close (MAIL); exit;