Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: PEAR Mail Queue

  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    152
    Thanks
    5
    Thanked 0 Times in 0 Posts

    PEAR Mail Queue

    Hello there,

    I am attempting to use the PEAR Mail_Queue tool on my shared server. However, I am getting this error when it is called:

    Code:
    <b>Fatal error</b>: Call to a member function put() on a non-object in <b>/usr/local/lib/php/Mail/Queue.php</b> on line <b>428</b><br />
    I do not know what the problem is, this is the function that calls it, and the associated arrays that it needs:
    PHP Code:
    $mail_db_options["type"]       = "db";
    $mail_db_options["dsn"]        = "mysql://user:pass@host/db";
    $mail_db_options["mail_table"] = "mail_queue";

    $mail_options["driver"]    = "smtp";
    $mail_options["host"]      = "localhost";
    $mail_options["port"]      = 25;
    $mail_options["localhost"] = "localhost"//optional Mail_smtp parameter
    $mail_options["auth"]      = false;
    $mail_options["username"]  = "user";
    $mail_options["password"]  = "pass";

    function 
    mailqueue_add$to$from$subject$msg$otherHeaders = array() ) {
        
    $queue =& new Mail_Queue($mail_db_options$mail_options);
        
    $otherHeadrs['To'] = $to;
        
    $otherHeaders['From'] = $from;
        
    $otherHeaders['Subject'] = $subject;
        
        
    $mime =& new Mail_mime();
        
    $mime->setTXTBody($msg);
        
    $body $mime->get();
        
    $otherHeaders $mime->headers($otherHeaders);
        echo 
    $body;
        
    $queue->put($from$to$otherHeaders$body);


    Any help as to why this is happening is greatly appreciated!

    Thanks!

  • #2
    New Coder
    Join Date
    Nov 2007
    Posts
    41
    Thanks
    5
    Thanked 1 Time in 1 Post
    Is it just me or are you trying to pass along variables from an array without taking them out of the array first. If you know where the function is defined you can use the array as a whole to pass along your data. Otherwise the way you're defining $otherHeadrs['To'] won't work because the variable 'to' is caught within an array!

  • #3
    Regular Coder
    Join Date
    May 2006
    Posts
    152
    Thanks
    5
    Thanked 0 Times in 0 Posts
    No the arrays are functioning properly, the problem was I needed to declare mail_db_options and mail_options as global so that they could be accessed when I instantiate the class. One of the most basic programming concepts... sometimes a break helps Thanks for your help!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •