problem with Multipart module

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default 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",
    >From => "mike\@bristolreccc.co.uk",
    >From => "mike\@bristolreccc.co.uk");
    $smtp->Text("text");
    $smtp->FileAttach ("doc_file.doc");
    $smtp->End();

    any help appreciated
    Mike Guest

  2. Similar Questions and Discussions

    1. #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...
    2. #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: ...
    3. #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...
    4. 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...
    5. 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...
  3. #2

    Default Re: problem with Multipart module

    From: mike <mike@redtux1.uklinux.net>
    > 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 {
    > ...
    Looks OK
    (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)
    > 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();
    Seems to be fine as well.

    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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139