Hey people,

    I know there's a list for PEAR also, but it seem there's nobody there...
in 2 days only two messages, so I'll post this here and if there's a better
place for this message, you tell me, alright?
    That's the deal:

    I've just got into pear, looking for a mail function with SMTP
authentication, well there is one, but it ins't working. I must confess I'm
a mechanical engineer and I've very little knowledge about object oriented
programming (that's what pear is about, aint't it?).
    I tried the example I found in the mail() documentation. which is:

require_once('mail.php');

$recipients = '[EMAIL PROTECTED]';

$headers['From']    = '[EMAIL PROTECTED]';
$headers['To']      = '[EMAIL PROTECTED]';
$headers['Subject'] = 'Test message';

$body = 'Testando essa bagaca!';

$params['host'] = 'smtp.sao.terra.com.br';
$params['auth'] = true;
$params['username'] = 'joao66br';
$params['password'] = 'mypass';

echo "opa";
var_dump($params);
// Create the mail object using the Mail::factory method
$result = $mail_object =& Mail::factory('smtp', $params);
if (PEAR::isError($result)) {
    print "Oops: " . $connection->getMessage() . "<br>\n";
    exit;
}

$resultsend = $mail_object->send($recipients, $headers, $body);
var_dump($resultsend);
echo "opa";
echo resultsend;
echo resultfactory;
?>

and what I get is:

>opaarray(4) { ["host"]=> string(21) "smtp.sao.terra.com.br" ["auth"]=>
>bool(true) ["username"]=> string(8) "joao66br" ["password"]=> string(6)
>"mypass" }

    Well the params vector is okay, but nothing below the command
Mail::factory('smtp', $params) seems to be working, not even the simple echo
"opa". There must me something going wrong with it, but why doesn't the
error show up, as it would with PHP?
    What is the use of the constructs such as "PEAR::isError" and
"Mail::factory" what do those "::" mean?

    Thanks,
    Joao.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to