Doc #8784 [Opn->Bgs]: Example code for Mail_mime does not work
| From: | kai at popwire dot com | Date: | Tue, 26 Sep 2006 08:03:39 +0000 |
| Subject: | Doc #8784 [Opn->Bgs]: Example code for Mail_mime does not work | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-8526@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=8784&edit=1
ID: 8784
User updated by: kai at popwire dot com
Reported By: kai at popwire dot com
-Status: Open
+Status: Bogus
Id: 8784
Type: Documentation Problem
Package: Documentation
Operating System: OS X 10.4.7
PHP Version: 5.1.2
New Comment:
D'oh! In fact the message was sent, but ended up in the spam
bucket :-/ Still, I'm worried by those error messages.
Previous Comments:
------------------------------------------------------------------------
[2006-09-25 08:44:15] kai at popwire dot com
Description:
------------
I copied the example script from http://pear.php.net/manual/
en/package.mail.mail-mime.example.php to a file
mailtest.php, only changing the $file to a file that existed
on my system and instead of postmaster@localhost I used my
own mail address [copied script included below]. Running
the script does not create/send an email message.
I have installed Mail-1.1.13 and Mail_Mime-1.3.1.
phpinfo() shows this PHP configure line:
'./configure' '--prefix=/usr/local/php5' '--with-config-
file-path=/usr/local/php5/lib' '--with-apxs' '--with-iconv'
'--with-openssl=/usr' '--with-zlib=/usr' '--with-mysql=/
Users/marc/svn/entropy/php-module/src/mysql-standard-*' '--
with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-
libxml-dir=/usr/local/php5' '--with-xsl=/usr/local/php5' '--
with-pdflib=/usr/local/php5' '--with-pgsql=/Users/marc/svn/
entropy/php-module/build/postgresql-build' '--with-gd' '--
with-jpeg-dir=/usr/local/php5' '--with-png-dir=/usr/local/
php5' '--with-zlib-dir=/usr' '--with-freetype-dir=/usr/
local/php5' '--with-t1lib=/usr/local/php5' '--with-imap=../
imap-2002d' '--with-imap-ssl=/usr' '--with-gettext=/usr/
local/php5' '--with-ming=/Users/marc/svn/entropy/php-module/
build/ming-build' '--with-ldap' '--with-mime-magic=/usr/
local/php5/etc/magic.mime' '--with-iodbc=/usr' '--with-
xmlrpc' '--with-expat-dir=/usr/local/php5' '--with-iconv-
dir=/usr' '--with-curl=/usr/local/php5' '--enable-exif' '--
enable-wddx' '--enable-soap' '--enable-sqlite-utf8' '--
enable-ftp' '--enable-sockets' '--enable-dbx' '--enable-
dbase' '--enable-mbstring' '--enable-calendar' '--with-bz2=/
usr' '--with-mcrypt=/usr/local/php5' '--with-mhash=/usr/
local/php5' '--with-mssql=/usr/local/php5' '--with-fbsql=/
Users/marc/svn/entropy/php-module/build/frontbase-build/
Library/FrontBase' '--enable-openbase_module' '--enable-
bcmath'
I have made no changes to php.ini.
Test script:
---------------
<?php
include('Mail.php');
include('Mail/mime.php');
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = '/Users/kai/Sites/mailtest.php';
$crlf = "\n";
$hdrs = array(
'From' => 'you@yourdomain.com',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('kai@popwire.com', $hdrs, $body);
?>
Expected result:
----------------
I expected the script to send me an email message containing
both plain and HTML text as well as a file attachment.
Actual result:
--------------
The httpd/
error.log gives the following messages:
[Mon Sep 25 14:26:43 2006] [error] PHP Notice: Only
variable references should be returned by reference in /usr/
local/php5/lib/php/Mail/mime.php on line 356
[Mon Sep 25 14:26:43 2006] [error] PHP Notice: Only
variable references should be returned by reference in /usr/
local/php5/lib/php/Mail/mime.php on line 434
[Mon Sep 25 14:26:43 2006] [error] PHP Notice: Only
variable references should be returned by reference in /usr/
local/php5/lib/php/Mail/mime.php on line 593
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=8784&edit=1