Ask a Question related to PERL Beginners, Design and Development.
-
Mike #1
problem with Multipart module
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",$smtp->Text("text");>From => "mike\@bristolreccc.co.uk",
>From => "mike\@bristolreccc.co.uk");
$smtp->FileAttach ("doc_file.doc");
$smtp->End();
any help appreciated
Mike Guest
-
#25995 [Asn]: multipart/form-date file upload problem.
ID: 25995 User updated by: s dot masugata at digicom dot dnp dot co dot jp Reported By: s dot masugata at digicom dot dnp dot... -
#25995 [Opn->Asn]: multipart/form-date file upload problem.
ID: 25995 Updated by: moriyoshi@php.net Reported By: s dot masugata at digicom dot dnp dot co dot jp -Status: ... -
#25995 [NEW]: multipart/form-date file upload problem.
From: s dot masugata at digicom dot dnp dot co dot jp Operating system: FreeBSD/Linux/Solaris(sparc) PHP version: 4.3.4RC2 PHP... -
problem with Module#append_features
Hi all, I need to write a constructor-like method for a module. From the help I have found the Module#append_features method, which look like is... -
Kernel module 'mga_vid' problem / XV problem
Hello I have a Matrox Millennium G200 graphics card. When I use the XV extension, videos render scrambled. This does not happen with XSHM (but... -
Jenda Krynicky #2
Re: problem with Multipart module
From: mike <mike@redtux1.uklinux.net>
Looks OK> 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 {
> ...
(I don't think it's the best idea to load the whole file into memory,
encode it in one go and then send it. For big files it would be
better to read+encode+send in chunks. IMHO of course)
Seems to be fine as well.> and this my script
>
> $smtp->Header(
> To => "$mailing1[2]",
> Subj => "Management Meeting",>> >From => "mike\@bristolreccc.co.uk",
> >From => "mike\@bristolreccc.co.uk");
> $smtp->Text("text");
> $smtp->FileAttach ("doc_file.doc");
> $smtp->End();
Could you send me a test doc by your script to [email]Jenda@Krynicky.cz[/email]?
Jenda
===== [email]Jenda@Krynicky.cz[/email] === [url]http://Jenda.Krynicky.cz[/url] =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
Jenda Krynicky Guest



Reply With Quote

