in reply to Emailing ZIP Attachment

I don't know much about Net::SMTP, but it seems to me you're not actually sending the file's data, just the headers. Looking at the docs, it appears Net::SMTP has no easy support for sending attachments at all. IMHO the above mentioned MIME::Lite is an excellent and easy module to send attachments. I suggest you check it out.

Replies are listed 'Best First'.
Re^2: Emailing ZIP Attachment
by Anonymous Monk on Sep 06, 2019 at 19:22 UTC

    HI Thanks for this information, after many try I finally have a Correct script using sendmail, this is my script you need some thinks

    1. $file are tha path to find the file 2. $namefile is the realname tu present un the e-mail 3. In $mail{body} you need know the TEXT after <<TEXT is the same of the final, and need start the line un the program, not indent. In my example user FINALBODY.

    This are my changes for work:

    use MIME::QuotedPrint; use MIME::Base64; use Mail::Sendmail; $host = "look.server.com.co"; $username = "MyEmailUser"; $password = "MyEmailPass"; $from = 'Willger@server.com.co'; $to = 'Torres@Server.com.co'; $mboundary="-FINALBLOCKgc0p4Jq0M2Yt08jU534c0p"; #this you cand select + any compouse of alfanumeric, but not change $mensaje = "Este es un mensaje en texto\n\n\n"; $html = "<HTLM><head><meta http-equiv=\"Content-Type\" content=\"text +/html; charset=ISO-8859-5\"></head> <p></p> <b>TEST TABLE</b> <p></p> <table border=1><tr><th>COLUMN1</th><th>COLUMN2</th><th>COLU +MN3</th></tr> <tr><th>DATA1</th><th>DATA2</th><th>DATA3</th></tr> <tr><th>NEXT1</th><th>NEXT2</th><th>NEXT3</th></tr> </table></HTML>"; %mail = ( 'To' => $to, 'From' => $from, 'Subject' => $asunto.$hora, 'Content-type' => 'multipart/mixed; charset=iso-8859-1; boundar +y='.$mboundary, ); ##Convert the file to encode base open (F, $mylocationfile) or die "Cannot read $file: $!"; binmode F; undef $/; $cfile = encode_base64(<F>); close F; $cfilelen = length $cfile; ##to start the next section of the mail $mboundary = '--'.$mboundary; $mail{body}= <<FINALBODY; $mboundary Content-Type: text/html; charset="iso-8859-1" $mensaje $html $mboundary Content-Disposition: attachment; filename="$mfilename" Content-Type: application/zip; name="$mfilename" Content-Transfer-Encoding: base64 Content-Length: $cfilelen $cfile $mboundary-- FINALBODY

    Thanks, And I hope help you.

    Willger Torres