LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   sending html text message with zip file attachment; Content-Type: multipart/mixed (https://www.linuxquestions.org/questions/programming-9/sending-html-text-message-with-zip-file-attachment%3B-content-type-multipart-mixed-457123/)

phelpsj 06-21-2006 11:30 PM

sending html text message with zip file attachment; Content-Type: multipart/mixed
 
My perl script attempts to send an email message in html
format with a .zip attachment. This runs on linux and the
html part works fine. It's the zip file attachment that I'm having trouble with. Is it something wrong with the way I've set up my boundary? Any ideas? Thanks!

...
...
my $boundary = "_boundarystring";
chdir "/tmp";
open ( MAIL, "|/usr/lib/sendmail -t" );

print MAIL <<"END_OF_MAIL";
FROM: $reply_to
TO: $ENV{'MAIL_LST'}
REPLY-TO: $reply_to
SUBJECT: $scriptname for $product $env was $success_string
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="$boundary"
Content-Type: text/html
<html>
<body>
Host: <strong>$te_host</strong><br>
<br>
Product: <strong>$product</strong><br>
<br>
Environment: <strong>$env</strong><br>
<br>
<br>
Stats zip file has been created on <strong>$te_host</strong> at:<br>
<br>
<strong>/tmp/$stats_file</strong><br>
</body>
</html>
--$boundary
Content-Type: application/zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$stats_file"
END_OF_MAIL
print MAIL `/usr/bin/uuencode $stats_file $stats_file`;
print MAIL "--$boundary--\n";
close MAIL;
----------------------------------------------------------------

The html section is rendered as it should be, but the .zip attachment is not:

Host: linuxqa1.dev.oclc.org

Product: FirstSearch

Environment: Active_EnvC


Stats zip file has been created on linuxqa1.dev.oclc.org at:

/tmp/FirstSearch_Active_EnvC_0606220017_stats.zip
--_boundarystring Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="FirstSearch_Active_EnvC_0606220017_stats.zip" begin 644 FirstSearch_Active_EnvC_0606220017_stats.zip M4$L#!`H``````(%2QS0````````````````%`!4`,C`P-B]55`D``Y'@AD1: M"YI$57@$`+!AL&%02P,$"@``````05G/-`````````````````@`%0`R,#`V M+S`V+U54"0`#27B11%H+FD15>`0`L&&P85!+`P0*``````"!4L`0`L&&P8:OO56U\ ML\!Z@>;\$I&BU#3#X@(SO934,KW\Y)QDO?RB]`8F]QHF-D;N=5<]4AM9?"Q^ M>2WD@_+;&E@""84I1:7-S#9VALI&=H;J)G9*!G:&!L(-/`%92:FU^2ZI%? M7((N"P!02P,$"@``````0&;(-```````````````

archtoad6 06-22-2006 08:50 AM

If you don't mind my asking, why on earth are you sending html e-mail? -- It's a horrible waste of bandwidth & storage, and a nearly 100% indicator of SPAM. Not to menion all the malware that can be associated w/ it. Personally, I generally don't accept it form anyone.


All times are GMT -5. The time now is 06:03 PM.