Here's how I do it...
srand(time ^ $$);
for (my $i = 0; $i++ < 24;) {
$boundary .= $boundaryv[rand(@boundaryv)];
}
print MAIL "To: $email\n";
print MAIL "From: $me\n";
print MAIL "Subject: $subject\n";
print MAIL "Content-Type: multipart/mixed; boundary=\"------------$boundary\"\n";
print MAIL "\n";
print MAIL "This is a multi-part message in MIME format.\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: text/plain; charset=us-ascii\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "Hello\n";
print MAIL "\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: application/octet-stream; name=\"$file\"\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: inline; filename=\"$file\"\n\n";
$/=0;
open INPUT, "$file";
binmode INPUT if ($^O eq 'NT' or $^O eq 'MSWin32');
while(read(INPUT, $buf, 60*57)) {
print MAIL &encode_base64($buf);
}
close INPUT;
print MAIL "\n--------------$boundary--\n";
print MAIL "\n";
close MAIL;
Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/
Code:
my @boundaryv = (0..9, 'A'..'F'); srand(time ^ $$);
for (my $i = 0; $i++ < 24;) {
$boundary .= $boundaryv[rand(@boundaryv)];
}
Code:
open(MAIL,"|$mail"); print MAIL "To: $email\n";
print MAIL "From: $me\n";
print MAIL "Subject: $subject\n";
print MAIL "Content-Type: multipart/mixed; boundary=\"------------$boundary\"\n";
print MAIL "\n";
print MAIL "This is a multi-part message in MIME format.\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: text/plain; charset=us-ascii\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "Hello\n";
print MAIL "\n";
print MAIL "--------------$boundary\n";
print MAIL "Content-Type: application/octet-stream; name=\"$file\"\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: inline; filename=\"$file\"\n\n";
Code:
my $buf; $/=0;
open INPUT, "$file";
binmode INPUT if ($^O eq 'NT' or $^O eq 'MSWin32');
while(read(INPUT, $buf, 60*57)) {
print MAIL &encode_base64($buf);
}
close INPUT;
print MAIL "\n--------------$boundary--\n";
print MAIL "\n";
close MAIL;
Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/