Error reporting with mail()
| From: | Joao Andrade | Date: | Sat, 15 Nov 2003 20:20:57 +0000 |
| Subject: | Error reporting with mail() | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8970@lists.php.net to get a copy of this message | ||
Hi,
This is my first e-mail the the pear general list.
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 = 'joao66br@yahoo.com.br';
$headers['From'] = 'centraldecaronas@terra.com.br';
$headers['To'] = 'joao66br@yahoo.com.br';
$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) seams to be working, not even the simple echo
"opa". There mest me something going wrong with it, but why doesn't the
error show up, as it would with PHP?
Thanks,
Joao.