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&;(-```````````````
|