Попробуй:
HTML письма
#!/usr/bin/perl
$sendmail = "/usr/sbin/sendmail";
$tomail = "куда";
$location = "редирект после";
$subject = "Тема письма";
read(STDIN, $buffer, $ENV{\'CONTENT_LENGTH\'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# strip off any possible SSI comment tags.
$value =~ s///g;
$in{$name} = $value;
}
open (MAIL, "|$sendmail -t");
print MAIL "To: <$in{\'email\'}>\\n";
print MAIL "From: <$tomail>\\n";
print MAIL "Reply-to: <$tomail>\\n";
print MAIL "Subject: $subject\\n";
print MAIL "MIME-Version: 1.0\\n";
print MAIL "Content-Transfer-Encoding: 8bit\\n";
print MAIL "Content-type: text/html;\\n";
print MAIL "X-Priority: 3\\n";
print MAIL "X-MSMail-Priority: Normal\\n\\n";
print MAIL "\\n\\n";
print MAIL "\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "\\n";
print MAIL "\\n\\n" ;
close(MAIL);
print "Location: $location\\n\\n";
Простое (текстовое) письмо:
#!/usr/bin/perl
$sendmail = "/usr/sbin/sendmail";
$tomail = "куда";
$location = "редирект после";
$subject = "Тема письма";
read(STDIN, $buffer, $ENV{\'CONTENT_LENGTH\'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# strip off any possible SSI comment tags.
$value =~ s///g;
$in{$name} = $value;
}
open (MAIL, "|$sendmail -t");
print MAIL "To: <$in{\'email\'}>\\n";
print MAIL "From: <$tomail>\\n";
print MAIL "Reply-to: <$tomail>\\n";
print MAIL "Subject: $subject\\n";
print MAIL "MIME-Version: 1.0\\n";
print MAIL "Content-Transfer-Encoding: 8bit\\n";
print MAIL "X-Priority: 3\\n";
print MAIL "X-MSMail-Priority: Normal\\n\\n";
print MAIL "\\n\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "Здесь что угодно\\n";
print MAIL "\\n\\n" ;
close(MAIL);
print "Location: $location\\n\\n";