Re: PEAR error
| From: | Burhan Khalid | Date: | Sun, 16 Nov 2003 22:07:42 +0000 |
| Subject: | Re: PEAR error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169853@lists.php.net to get a copy of this message | ||
Joao Andrade wrote:
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 ]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 SMTPauthentication, 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;}
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."What is the use of the constructs such as "PEAR::isError" and"Mail::factory" what do those "::" mean?