[nycphp-talk] mime mail
Willliam Klein
willie at pdfsystems.com
Thu Jul 24 16:53:32 EDT 2003
Hi All;
I'm trying to use mime-mail from PEAR and I not succeeding.
I get my mail but it all arrives as plain text.
I've tried attaching a file and sending it in the body of the email.
BTW I've looked at the php.pear.general newsgroup and the same problem is
over there with no solution.
the code:
<?php
require_once('Mail.php');
require_once('Mail/mime.php');
ob_start();
$orderNumber="043341-00";
$passVar="1";
include('showOPA.php');
$blah = ob_get_contents();
ob_end_clean();
echo "Blah = $blah";
$tempFileName = tempnam('/home/httpd/html/image/temp',-data);
echo "tempFileName is $tempFileName";
$temp_fh = fopen($tempFileName,'w') or die ( "can't do it:$php_errormsg");
fputs($temp_fh,$blah);
copy($tempFileName, "/home/httpd/html/image/temp/$orderNumber.htm");
$to = 'willie at pdfsystems.com';
$headers['From'] = 'willie at pdfsystems.com';
$headers['Subject'] = 'test mime';
$mime = new Mail_mime;
$text = 'text of tests';
$mime->setTXTBody($text);
$file = '/home/httpd/html/image/temp/'.$orderNumber . '.htm';
echo "file is $file";
$mime->addAttachment($file,'text/html');
$html = $blah;
$mime->setHTMLBody($blah);
$headers = $mime->headers($headers);
$param["html_encoding"]="7bit";
$body = $mime->get($param);
$message =& Mail::factory('mail');
$message->send($to, $headers, $body);
Mail_mime::send();
?>
and I get plain text html and what looks like an encoded file as text in the
body of the email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030724/fdfb2a22/attachment.html>
More information about the talk
mailing list