I am trying to use the Net::SMTP::Multipart to send attachments (word
doc) and the encoding is getting mangled on non-linux machines
If I send it to myself everything is fine (either external or via my
mail server)
this appears to the relevant part of the modules
sub FileAttach {
my $self = shift;
foreach my $file (@_) {
unless (-f $file) {
carp 'Net::SMTP::Multipart:FileAttach: unable to find file
$file';
next;
}
my($bytesread,$buffer,$data,$total);
open(FH,"$file") || carp "Net::SMTP::Multipart:FileAttach: failed
to open $file\n";
binmode(FH);
while ( ($bytesread=sysread(FH,$buffer, 1024))==1024 ){
$total += $bytesread;
# 500K Limit on Upload Images to prevent buffer overflow
#if (($total/1024) > 500){
# printf "TooBig %s\n",$total/1024;
# $toobig = 1;
# last;
#}
$data .= $buffer;
}
if ($bytesread) {
$data .= $buffer;
$total += $bytesread ;
}
#print "File Size: $total bytes\n";
close FH;
if ($data){
$self->datasend("--$b\n");
$self->datasend("Content-Type: ; name=\"$file\"\n");
$self->datasend("Content-Transfer-Encoding: base64\n");
$self->datasend("Content-Disposition: attachment; =filename=
\"$file\"\n\n");
$self->datasend(encode_base64($data));
$self->datasend("--$b\n");
}
}
}
and this my script
$smtp->Header(
To => "$mailing1[2]",
Subj => "Management Meeting",
>From => "[EMAIL PROTECTED]",
>From => "[EMAIL PROTECTED]");
$smtp->Text("text");
$smtp->FileAttach ("doc_file.doc");
$smtp->End();
any help appreciated
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>