[NEWBIE] PEAR::Mail Help Please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all.  I am new to using PEAR, but not so much to PHP.  I was looking
for a little help.

 

I'm trying to get my contact script to work with the PEAR::Mail extension.
So I followed the "tutorial" on pear.php.net about using the object =&
Mail::factory() and then the object::send() method to send the email.  So
after doing that, I get the following code:

Main.php

$recips = $Recip.'; ';

$recips .= $Email;

                                    

require_once('config.php');

                                    

$headers['From'] = $Name." <".$Email.">";

$headers['Subject'] = $Subject;

$headers['To'] = $Recip;

$headers['Cc'] = $Email;

 

require_once('Mail.php');

$mail_object =& Mail::factory($method, $params);

$mail_object->send($recips, $headers, $message);

if($mail_object != 'TRUE'){

            require_once('PEAR.php');

            $error = PEAR_Error::toString();

            echo "<b>".$error."</b>";

            $_REQUEST['pageid'] = '23';

}

else{

            $_REQUEST['pageid'] = '22';

}

 

Config.php

$method = 'smtp';

 

//$params['sendmail_path'] = "/usr/sbin/sendmail";

$params['host'] = "localhost";

$params['port'] = "25";

$params['auth'] = "TRUE";

$params['username'] = "ridgeswi";

$params['password'] = "**********";

The email is not sent to either recipient, and I don't get an error, or if I
do, it has no values:

i.e. [: message="" code=0 mode= level= prefix="" info=""]

 

Anyone see anything wrong?  Is it perhaps that I'm using tabs instead of
spaces for indentation or what?  Thanks for the help.

 

~Brett

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux