Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-22-2006, 12:30 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 1

Rep: Reputation: 0
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
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
Host: <strong>$te_host</strong><br>
Product: <strong>$product</strong><br>
Environment: <strong>$env</strong><br>
Stats zip file has been created on <strong>$te_host</strong> at:<br>
Content-Type: application/zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="$stats_file"
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:


Product: FirstSearch

Environment: Active_EnvC

Stats zip file has been created on at:

--_boundarystring Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="" begin 644 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&;(-```````````````
Old 06-22-2006, 09:50 AM   #2
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 232Reputation: 232Reputation: 232
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
php & imap: where's the Content-type of one attachment? eantoranz Programming 1 05-26-2006 11:37 AM
use CGI vs. content-type: text/html johnensd Red Hat 0 05-10-2004 12:55 AM
How do I extract a multipart zip/ror file drspore Linux - General 2 02-07-2004 01:09 AM
Content-Type: multipart/appledouble - Mail Problem WeNdeL Linux - Software 1 09-02-2003 03:04 PM
set content-type to 'text/html' in sendmail, using perl script brokenfeet Programming 3 08-05-2003 03:12 PM

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration