Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Emailing ZIP Attachment

by Anonymous Monk
on Sep 06, 2019 at 19:22 UTC ( #11105739=note: print w/replies, xml ) Need Help??


in reply to Re: Emailing ZIP Attachment
in thread Emailing ZIP Attachment

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11105739]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2019-10-17 00:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?