Re: need help with using Mail.php
| From: | Paula Fether | Date: | Wed, 18 Oct 2006 19:25:30 +0000 |
| Subject: | Re: need help with using Mail.php | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25533@lists.php.net to get a copy of this message | ||
Done, but it can't find Mail.php:
*Warning*: main(Mail.php): failed to open stream: No such file or directory
in */Users/paulafether/Sites/gui4me.com/Temail.php* on line *2*
*Fatal error*: main(): Failed opening required 'Mail.php'
(include_path='.:/usr/lib/php') in *
/Users/paulafether/Sites/gui4me.com/Temail.php* on line *2*
Doing "which Mail.php" in Terminal also comes up empty.
On 10/18/06, Justin Patrin <papercrane@gmail.com> wrote:
On 10/18/06, Paula Fether <gridzmaster@gmail.com> wrote: It downloaded Mail-1.1.14.tgz and Net_SMTP-1.2.8.tgz, then said First thing you should do is: pear list-upgrades then pear upgrade-all Once that's done, look again at: pear help install You want pear install -a Mail Net_SMTP requires package `Net_Socket' requires package `Auth_SASL' Net_SMTP: Dependencies failed Here are the config settings:PEAR executables directory bin_dir /usr/bin PEAR documentation directory doc_dir /usr/lib/php/doc PHP extension directory ext_dir/usr/lib/php/extensions/no-debug-non-zts-20020429PEAR directory php_dir /usr/lib/php PEAR Installer cache directory cache_dir /tmp/pear/cache PEAR data directory data_dir /usr/lib/php/data PHP CLI/CGI binary php_bin /usr/bin/php PEAR test directory test_dir /usr/lib/php/test Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 HTTP Proxy Server Address http_proxy <not set> PEAR server master_server pear.php.net PEAR password (for password <not set>maintainers)Signature Handling Program sig_bin /usr/local/bin/gpg Signature Key Directory sig_keydir /private/etc/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set>maintainers) On 10/18/06, Justin Patrin <papercrane@gmail.com> wrote:On 10/18/06, Paula Fether < gridzmaster@gmail.com> wrote:already---------- Forwarded message ---------- From: Paula Fether <gridzmaster@gmail.com> Date: Oct 18, 2006 12:06 PM Subject: Re: [PEAR] need help with using Mail.php To: papercrane@reversefold.com Hi Justin, thanks for the quick response. PEAR came with my php installation, so I thought everything wasI justhere. That's why I was surprised that it couldn't find Mail.php. Soneed todownloaded it and put it in the directory with my site. So I guess Ithere anydownload the whole PEAR package and do an install then? If so, areseem toprecautions I need to take concerning other programs that use it?Open up a terminal and type: pear help Then use it to do things like: pear install Mail Net_SMTPAlso I do have an error routine when calling Mail, but it doesn'thad toget there.Did you try the error handling methods on my wiki?Thanks again for your help.! PS: I've had other problems with paths, maybe this is another one. Iappendmanually add the path to mysqldump in Terminal (mac osx), and thenjust usethe PATH statement in php in order to do mysqldump from there.It's possible that 'pear' isn't in your path. Try the above and see if it is. include_path in PHP is different.On 10/18/06, Justin Patrin <papercrane@gmail.com > wrote:On 10/18/06, Paula Fether <gridzmaster@gmail.com> wrote:Hi, I'm trying to send simple emails from a website. I used tosee"mail()" but noticed that if someone reads the headers they cantriedinformation about the webhost that I'd rather not send, so IwroteMail.php.At first it couldn't find the program so I downloaded it. Then Ion athefollowing test code: <?phprequire_once " Mail.php"; // use PEAR$recipients = "you@mail.com"; $headers["From"] = " me@mail.com"; $headers["To"] = "you@mail.com"; $headers["Subject"] = "test with remote host";$body = "just testing some more now";$params["host"] = "mail.me.com"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = " owner@me.com"; $params["password"] = "mypassword";$mail_object = &Mail::factory("smtp", $params); $mail_object = Mail::send($recipients, $headers, $body); if (PEAR::isError($mail_object)) {echo("<p>" . $mail_object->getMessage() . "</p>"); }else{ echo("<p>Message successfully sent!</p>"); }?> But it gives the error "*Fatal error*: Call to a member function$body)".non-object in */mypath.com/Mail.php* on line *90*". That's where Mail calls "function send($recipients, $headers,theHelp please?A few things: 1) Did you install via the PEAR installer or by manually copyingthisfile? You shoul dbe using the PEAR installer. 2) Did you install Net_SMTP? The smtp backend to Mail requireshttp://pear.reversefold.com/dokuwiki/doku.php?id=phpfaqs#what_does_call_to_undefined_method_xxxxxx_meanpackage as well. 3) Are you checking for errors before usin your object? Likely the above problems are causing an error to be returned. See:-- Justin Patrin-- Justin Patrin-- Justin Patrin