Ave, The text file went through fine! Absolutely perfect... I attached a normal text file with just one sentence. I sent it and it arrived in my mailbox without any problems.. It opened and it had the sentence.. And no warnings or errors. Using my code, I'm able to send the HTML mail with 2 attachments. Everything is fine except that the pdf attachments are just blank and corrupted. One thing I would like to point out is that I'm only trying to send PDF files. The purpose of my code is to send PDF files only, not any other type. Here's my code.. This is the form to gather data: <form action=<?php echo $PHP_SELF ?> method=post ENCTYPE="multipart/form-data" name="f1" id="f1" > <table> <tr> <td align="left" valign="middle" class="style13">From (Name):</td> <td><input name=from_name type=text value="Gerson Bullock" size="40"></td> </tr> <tr> <td align="left" valign="middle" class="style13">From (Email):</td> <td><input name=from type=text value="gerson@xxxxxxxxxxxxxxxxxxxx" size="40"></td> </tr> <tr> <td align="left" valign="middle" class="style13">To (First,Last):</td> <td><input name=to_nameF type=text id="to_nameF" size="15"> <input name=to_nameL type=text id="to_nameL" size="15"></td> </tr> <tr> <td align="left" valign="middle" class="style13">To (Email):</td> <td><input name=to type=text size="40"></td> </tr> <tr> <td align="left" valign="middle" class="style13">Subject:</td> <td><input name=subject type=text value="Your Conversation with Gerson Bullock" size="40"></td> </tr> <tr> <td align="left" valign="middle" class="style13">Attachment 1 </td> <td><input type=file name=file1></td> </tr> <tr> <td align="left" valign="middle" class="style13">Attachment 2 </td> <td><input type=file name=file2></td> </tr> </table> <input name="message_html" type="hidden" id="message_html"> <input name="doSubmit" type=submit id="doSubmit" value="Send Mail"> </form> And this is the PHP Code that handles the mail & attachment: <?php $message_html = "<b>Test</b>"; $message_html = stripslashes($message_html); $message_text = "Informed Sources Inc."; $m = new CMIMEMail("$to_nameF $to_nameL <$to>","$from_name <$from>",$subject); $m->mailbody($message_text, $message_html); if( $file1) { $m->attachFile_raw($file1,$file1_name,$file1_type); }; if( $file2) { $m->attachFile_raw($file2,$file2_name,$file2_type); }; $m->send(); ?> <?php /* * $m = new CMIMEMail($to,$from,$subject); * $m->mailbody("This is simply text","<html><body><h1>This is HTML text</h1>"); * $m->attach("example.html","text/html",$filebody); * $m->attachFile("resume.gif","image/gif"); * $m->send(); */ class CMIMEMail { var $to; var $boundary; var $smtp_headers; var $filename_real; var $body_plain; var $body_html; var $atcmnt; var $atcmnt_type; function CMIMEMail($to,$from,$subject,$priority=3) { $this->to=$to; $this->from=$from; $this->subject=$subject; $this->priority=$priority; $this->boundary="----=_NextPart_".time()."_".md5(time())."_"; } function mailbody( $plain, $html="" ) { $this->body_plain=$plain; $this->body_html=$html; } function attach( $name, $content_type, $data ) { } function attachfile_raw( $fname, $mailFileName, $content_type ) { if($f=@fopen($fname,"r")) { $this->atcmnt[$mailFileName]=fread($f,filesize($fname)); $this->atcmnt_type[$mailFileName]=$content_type; fclose($f); } } function attachfile( $fname, $content_type ) { attachfile_raw($fname,$fname,$content_type); } function clear() { unset( $atcmnt ); unset( $atcmnt_type ); } function makeheader() { $out ="From: ".$this->from."\n"; $out.="Reply-To: ".$this->from."\n"; $out.="MIME-Version: 1.0\n". "Content-Type: multipart/mixed;\n\t boundary=\"".$this->boundary."\"\n". "X-Priority: ".$this->priority."\n". "X-Mailer: phpMimeMail ( http://www.informed-sources.com/ )\n"; return $out; } function makebody() { $boundary2= "----=_NextAttachedPart_".time()."_".md5(time()+101)."_"; $out=""; if( " ".$this->body_html!=" " ) { $out="\nThis is a multi-part message in MIME format.\n\n"; $out.="--".$this->boundary."\nContent-Type: multipart/alternative;\n\tboundary=\"$boundary2\"\n"; $out.="$body_plan\n". "--$boundary2\nContent-Type: text/plain\n". # "Content-Disposition: inline\n". "Content-Transfer-Encoding: quoted-printable\n\n". $this->body_plain. "\n\n--$boundary2\n". "Content-Type: text/html\n". # "Content-Disposition: attachment;\n\tfilename=\"message.html\"\n". "Conent-Transfer-Encoding: quoted-printable\n". "\n$this->body_html\n\n". "--$boundary2--\n"; } else { $out="\n\n".$this->body_plain."\n\n"; $out.="--".$this->boundary."\n". "Content-Type: text/plain\n". "Content-Transfer-Encoding: quoted-printable\n\n". $this->body_plain. "\n\n--".$this->boundary. "\n"; } if( is_array( $this->atcmnt_type ) ) { reset( $this->atcmnt_type); while( list($name, $content_type) = each($this->atcmnt_type) ) { $out.="\n--".$this->boundary."\nContent-Type: $content_type\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename=\"$name\"\n\n". chunk_split(base64_encode($this->atcmnt[$name]))."\n"; } } $out.="\n--".$this->boundary."--\n"; return $out; } function send(){ echo "<b><i><small><Mail Sent Successfully</b></i></small>"; mail( $this->to, $this->subject, $this->makebody(),$this->makeheader() ); } } ?> On 10/5/04 12:24 PM, "Marek Kilimajer" <lists@xxxxxxxxxxxxx> wrote: > PHP Junkie wrote: >> Ave, >> >> I didn't find any php warnings... Instead there was a whole bunch of coding >> much of which seemed like junk. I ran a search but no php warnings >> anywhere.. When I open the pdf in a text editor. > > Send a text file as an attachement, it will be easier to spot the error. > You can then run diff on original and attachement. > > Also, show the code. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php