[nycphp-talk] mime mail
Willliam Klein
willie at pdfsystems.com
Fri Jul 25 16:42:37 EDT 2003
HI All;
In case anyones wondering I never could get PEARs mime mail to work right.
As I said people on the php.pear.general list don't have an answer either.
But the htmlMimeMail class at phpguru.org works first time no muss no fuss.
:)
willie
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]On
Behalf Of Willliam Klein
Sent: Thursday, July 24, 2003 4:54 PM
To: 'NYPHP Talk'
Subject: [spam] [nycphp-talk] mime mail
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/20030725/61a43ca9/attachment.html>
More information about the talk
mailing list