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; }
What is $connection?
Try
$mail_object =& Mail::factory('smtp', $params); if (PEAR::isError($mail_object)) { die($mail_object->getMessage()); } $mail_object->send($recipients,$headers,$body); if (PEAR::isError($mail_object)) { die($mail_object->getMessage()); }
[ trim ]
What is the use of the constructs such as "PEAR::isError" and "Mail::factory" what do those "::" mean?
The techincal term for :: is "paamayim nekudotayim" (try saying that three times fast). Most people call it the scope resolution operator. You can read more about what it is and what it does at
http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php
-- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com ----------------------- "Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing."
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php