The problem I was having turned out that I need to add extra "\n" to some of the lines to the $EmailMsg. It turned out that MS-Outlook doesn't work without some extra "\n" for some reason. Some other people told me they have this same problem with different Mail Client software as well, so it seemt that not all mail client work alike.
Scott F. "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Fellas! > > I already whipped up the script to get the PHP mail() to send an email > with body text, along with the file attachment. Still haven't got this to > work right. If I omit out the attachment feature then the mail() work > successfully and I receive an email with body message successfully. But > with attachment, I'm able to get the mail to be send successfully but I > receive email without body text and without attachment. I have been looking > around on the Internet for guidance and tweak my php script, but so far no > luck. So, can anyone look into it and correct it for me? > > --snip-- > $pdf_filename=date("Y_m_d_H_i_s")."_Invoice.pdf"; > $pdf_filepath="pdf_archive/".$pdf_filename; > > $fp = fopen($pdf_filepath, 'rb'); > $pdf_raw_data = fread ($fp, filesize($pdf_filepath)); > fclose ($fp); > > $EmailMsg = "--0-1076063429-1066421657=:70798"; > $EmailMsg .= "Content-Type: text/plain; chrset=us-ascii"; > $EmailMsg .= "Content-Id:"; > $EmailMsg .= "Content-Disposition: inline"; > $EmailMsg .= "\n\tDate:\t\t".date("F d, Y @ g:i:s A"); > $EmailMsg .= "\n\n\t(( Text Message ))\n"; > $EmailMsg .= "\n\n\t========= Enclosed PDF File ========="; > $EmailMsg .= "\n\tAttached File:\t".trim($pdf_filename); > $EmailMsg .= "\n\n\t(( Base64 Message [PDF File] ))"; > $EmailMsg .= "\n\n--0-1076063429-1066421657=:70798"; > $EmailMsg .= "Content-Type: application/pdf; > name='".trim($pdf_filename)."'"; > $EmailMsg .= "Content-Transfer-Encoding: base64"; > $EmailMsg .= "Content-Description: ".trim($pdf_filename)."'"; > $EmailMsg .= "Content-Disposition: attachment; > filename='".trim($pdf_filename)."'"; > $EmailMsg .= $pdf_raw_data; > $EmailMsg .= "--0-1076063429-1066421657=:70798"; > > $MARKET_Subject = "Invoice Statement"; > $MARKET_Message = $EmailMsg; > $MARKET_To = "[EMAIL PROTECTED]"; > $MARKET_From = "[EMAIL PROTECTED]"; > > $MARKET_Header = "From: ".$MARKET_From."\r\n"; > $MARKET_Header .= "Return-Path: ".$MARKET_From."\r\n"; > $MARKET_Header .= "Error-To: ".$MARKET_From."\r\n"; > $MARKET_Header .= "MIME-Version: 1.0\r\n"; > //$MARKET_Header .= "Content-Type: text/plain; > charset=iso-8859-1\r\n"; > $MARKET_Header .= "Content-Type: multipart/mixed; > boundary='0-1076063429-1066421657=:70798\r\n"; > $MARKET_Header .= "X-Priority: 3\r\n"; > $MARKET_Header .= "X-MSMail-Priority: Normal\r\n"; > $MARKET_Header .= "X-Mailer: PHP ".phpversion()."\r\n"; > > > if(mail($MARKET_To,$MARKET_Subject,$MARKET_Message,$MARKET_Header,"-f$MARKET > _From")) > { > $email_status = "E-Mail was successfully send!!"; > } else { > $email_status = "E-Mail failed to be send!! (Failed)"; > } > echo $email_status; > --snip-- > > Thanks a million! > Scott F. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php