Edit report at http://pear.php.net/bugs/bug.php?id=14859&edit=1
ID: 14859
Comment by: foxrings
Reported By: foxrings at gmail dot com
Summary: Call to undefined method
Mail_Queue_Error::getRecipient()
Status: No Feedback
Type: Bug
Package: Mail_Queue
Operating System: Linux 2.6.24 Ubuntu
Package Version: 1.2.2
PHP Version: 5.2.4
Assigned To: till
New Comment:
for anyone that is googling this in the future
your problem may be different but for me it was
my "MDB2_Driver_mysql" not being installed
http://pear.php.net/package/MDB2_Driver_mysql
if that isn't your problem...
i found my problem with i started using "print_r($mail_queue)"
to output the errors
idk why i could not get the errors to output using the built in
function... but the print_r helped me solved something i was working on
for 8 hours+ in like 15 mins
Previous Comments:
------------------------------------------------------------------------
[2008-10-24 23:31:05] till
Most likely not a bug, but wrong usage (and essentially wrong
configuration).
Try the following:
$mail_queue = ...
if ($mail_queue->hasErrors()) {
var_dump($mail_queue->getErrors());
exit;
}
Problem is on PHP4, we couldn't throw an exception from the
constructor. On PHP5 this is possible, but introducing it now is a major
BC break and therefor will not happen in Mail_Queue.
We are gonna improve this in Mail_Queue2.
Let me know if this helps!
Till
------------------------------------------------------------------------
[2008-10-24 16:40:44] mkaltoft
Description:
------------
The test script gives the error:
Fatal error: Call to undefined method Mail_Queue_Error::getRecipient()
in /usr/share/php/Mail/Queue.php on line 370
This is a fresh pear install downloaded with 'pear install Mail_Queue',
the SQL table is from the included documentation, the test-script is
from the PEAR package.
The script gives the error both with and without mails in the mail
queue.
I realise this has been filed as a bug before, with the comment: not a
bug.
I would appreciate it if I could get a more thorough explanation, as I
seem to only use the provided examples. If this is not a bug, what
should I have done to empty my queue and send the mails in the queue?
SQL table:
CREATE TABLE mail_queue (
id INT NOT NULL default 0 PRIMARY KEY,
create_time timestamp NOT NULL default '1970-01-01 00:00:00',
time_to_send timestamp NOT NULL default '1970-01-01 00:00:00',
sent_time timestamp default NULL,
id_user INT NOT NULL default 0,
ip varchar(20) NOT NULL default 'unknown',
sender varchar(50) NOT NULL default '',
recipient text NOT NULL,
headers text,
body text,
try_sent INT NOT NULL default 0,
delete_after_send INT NOT NULL default 1
);
CREATE INDEX mailq_time_to_send ON mail_queue (time_to_send);
CREATE INDEX mailq_id_user ON mail_queue (id_user);
Test script:
---------------
require_once "Mail/Queue.php";
$db_options['type'] = 'db';
$db_options['dsn'] = 'pgsql://user:password@localhost/db';
$db_options['mail_table'] = 'mail_queue';
$mail_options['driver'] = 'smtp';
$mail_options['host'] = 'smtp.mail.dk';
$mail_options['port'] = 25;
$mail_options['auth'] = false;
$mail_options['username'] = '';
$mail_options['password'] = '';
$max_ammount_mails = 50;
$mail_queue =& new Mail_Queue($db_options, $mail_options);
$mail_queue->sendMailsInQueue($max_ammount_mails);
Expected result:
----------------
I expect the queue to be emptied and the mails in the queue to be sent
to the smtp server
Actual result:
--------------
martin@server:/usr/share/php/docs/Mail_Queue/docs$ php -q
send_example.php
Fatal error: Call to undefined method Mail_Queue_Error::getRecipient()
in /usr/share/php/Mail/Queue.php on line 370
------------------------------------------------------------------------