[an error occurred while processing this directive]

Отправка почты с вложением из perl с помощью sendmail
use MIME::Base64 qw(encode_base64);

my $sendmail = '/usr/sbin/sendmail';
my $to = 'linux@domain1.ru';
my $from = 'my@domain2.ru';
my $attachment = '/path_to/file.tar.gz';

my $buf;
my $subject = MIME::Base64::encode_base64('Здесь размещаем тему письма.');
   $subject =~ s/\n//g;
my $data;
   $data = MIME::Base64::encode_base64("<p>Здесь<br>Можно разместить текст сообщения.<br></p>");
my $boundary = 'simple boundary';
open(MAIL, "| $sendmail -t -oi") or die("$!");

print MAIL <<EOF; 
To: $email_to 
From: $email_from 
Subject: =?UTF-8?B?$subject?= 
Content-Type: multipart/mixed; boundary="$boundary" 
 
This is a multi-part message in MIME format. 
--$boundary 
Content-Type: text/html; charset=UTF-8 
Content-Transfer-Encoding: base64 
 
$data 
--$boundary 
Content-Type: application/octet-stream; name="$attachment" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment; filename="$attachment" 
 
EOF

open(FILE, "<$attachment") or die "$!";

while (read(FILE, $buf, 60*57)) { print MAIL encode_base64($buf); }

close FILE;
close MAIL;
 
28.11.2005 , Автор: Andrey
Ключи: mail, mime, perl / Лицензия: CC-BY
Раздел:    Корень / Программисту и web-разработчику / Perl / Работа с электронной почтой

[an error occurred while processing this directive]

[an error occurred while processing this directive]