Skip to main content

Trouble using PEAR"s Mail_Queue



I'm trying to implement PEAR's Mail_Queue package to queue some emails for a web application. I've used the documentation at http://pear.php.net/manual/en/package.mail.mail-queue.mail-queue.tutorial.php to write a small test script.





My problem is that the database is not being updated, and it's not producing errors.





EDIT







// mail_queue db options

$db_options['type'] = 'mdb2';

$db_options['dsn'] = DSN;

$db_options['mail_table'] = 'mail_queue';



// mail_queue sending options

$mail_options['driver'] = 'smtp';

$mail_options['host'] = 'smtp.gmail.com';

$mail_options['port'] = 25;

$mail_options['localhost'] = $host;

$mail_options['auth'] = true;

$mail_options['user'] = MAILUSER;

$mail_options['pass'] = MAILPASS;



require "Queue.php";



$mail_queue =& new Mail_Queue($db_options,$mail_options);



$from = 'someone@domain.ca';

$to = 'martin@starmedia.ca';

$message = 'This is a test';



$headers = array('From' => $from,

'To' => $to,

'Subject' => 'Someone has sent you an email!');



$mime =& new Mail_mime();

$mime->setTXTBody($message);

$body = $mime->get();



$headers = $mime->headers($headers,true);

print $mail_queue->put($from,$to,$headers,$body);







This produces the error Mail Queue Error: Cannot connect to database . However I checked all of the connection information and it's correct. Also, adding if (PEAR::isError($mail)) die($mail->getMessage()); produces no errors!


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?