Re: need help with using Mail.php
| From: | Justin Patrin | Date: | Fri, 20 Oct 2006 00:02:12 +0000 |
| Subject: | Re: need help with using Mail.php | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25563@lists.php.net to get a copy of this message | ||
On 10/19/06, Paula Fether <gridzmaster@gmail.com> wrote:
Tried two examples: example at http://us3.php.net/mail: $mail_object =& Mail::factory("smtp", $params); $mail_object->send($recipients, $headers, $body);This looks right.
results I get: Warning: send(Net/SMTP.php): failed to open stream: No such file or directory in /usr/lib/php/Mail/smtp.php on line 206 Warning: send(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/php/includes:/usr/lib/php:usr/bin:usr/bin/php:/private/etc') in /usr/lib/php/Mail/smtp.php on line 206 Fatal error: Cannot instantiate non-existent class: net_smtp in /usr/lib/php/Mail/smtp.php on line 210Well, this is, of course, because Net_SMTP isn't installed.
On 10/19/06, Justin Patrin <papercrane@gmail.com> wrote: On 10/19/06, Paula Fether <gridzmaster@gmail.com> wrote:/usr/lib/php/extensions/no-debug-non-zts-20020429We've Got Mail!! But also this message: Fatal error: Call to a member function on a non-object in /usr/lib/php/Mail.php on line 90You can't call Mail::send(). You have to call Mail::factory to get a Mail object, then call send on that object. See the examples.On 10/19/06, Justin Patrin < papercrane@gmail.com> wrote:..........................................................done:On 10/19/06, Paula Fether <gridzmaster@gmail.com> wrote:sudo pear upgrade Archive_Tar downloading Archive_Tar- 1.3.1.tgz ... Starting to download Archive_Tar- 1.3.1.tgz (15,102 bytes) .....done: 15,102 bytes upgrade ok: Archive_Tar 1.3.1 sudo pear upgrade PEAR downloading PEAR-1.4.11.tgz ... Starting to download PEAR-1.4.11.tgz (283,272 bytes)utilize283,272 bytes Optional dependencies: package `PEAR_Frontend_Web' version >= 0.5.0 is recommended tosomeutilizefeatures. package `PEAR_Frontend_Gtk' version >= 0.4.0 is recommended tosomeutilizefeatures. package `PEAR_Frontend_Gtk2' version >= 0.1.0 is recommended tosome..........................................................done:pearcmd.phpfeatures. upgrade ok: PEAR 1.4.11 directory listing of /usr/lib/php showsArchive Net PEAR.php buildpeclcmd.phpConsole OS System.php datatestHTML PEAR XML docStill can't find Mail.phpBecause it was never installed. You need to read the output of the pear command. Now that you've upgraded PEAR you can install packages with package.xml 2.0. Install Mail again: pear install MailOn 10/19/06, Justin Patrin < papercrane@gmail.com> wrote:On 10/19/06, Paula Fether < gridzmaster@gmail.com> wrote:---------- Forwarded message ---------- From: Paula Fether < gridzmaster@gmail.com > Date: Oct 19, 2006 8:15 AM Subject: Re: [PEAR] need help with using Mail.php To: papercrane@reversefold.com pear info PEAR gives: About PEAR-1.3.6 ================Provides Classes: OS_Guess, System Package PEAR Summary PEAR Base System Description The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception php5-only exception class * the beta-quality PEAR_ErrorStack advanced error handling mechanism * the PEAR_Error error handling mechanism * the OS_Guess class for retrieving info about the OS where PHP is running on * the System class for quick handling common operations with files and directories * the PEAR base class Maintainers Stig Bakken < stig@php.net> (lead) Tomas V.V.Cox <cox@idecnet.com> (lead) Greg Beaver < cellog@php.net> (lead) Pierre-Alain Joye <pajoye@pearfr.org> (lead) Martin Jansen < mj@php.net> (developer) Version 1.3.6 Release Date 2005-08-18Release State stable Release License PHP License Release Notes * Bump XML_RPC dependency to 1.4.0* return by reference from PEAR::raiseError() Release Deps PHP >= 4.2 Package Archive_Tar >= 1.1 Package Console_Getopt >= 1.2 Package XML_RPC >= 1.4.0 ext xml == ext pcre == ext xmlrpc ==Last Modified 2006-03-05 And pear upgrade PEAR gives downloading PEAR-1.4.11.tgz ... Starting to download PEAR-1.4.11.tgz (283,272 bytes)..........................................................done:283,272bytes requires package `Archive_Tar' >= 1.3.1 PEAR: Dependencies failedYep, so upgrade that package first: pear upgrade Archive_Tar pear upgrade PEAROn 10/19/06, Justin Patrin < papercrane@gmail.com > wrote:On 10/18/06, Paula Fether <gridzmaster@gmail.com > wrote:downloading PEAR-1.4.11.tgz ... Starting to download PEAR-1.4.11.tgz (283,272 bytes)for283,272 bytes Release for 'pear' dependency Release for 'pear' Release'pear'therequires'PEAR_Frontend_Gtk2'dependency 'PEAR_Frontend_Web' has state dependencyhasstate'alpha', requires 'stable' 'PEAR_Frontend_Gtk' 'beta','stable'That output doesn't make sense to me.... could you do: pear info PEAR Then try: pear upgrade PEARhas state 'beta', requires 'stable'upgrade failedOn 10/18/06, Justin Patrin < papercrane@gmail.com> wrote:On 10/18/06, Paula Fether < gridzmaster@gmail.com > wrote:Yes, I did that twice.Ok, well, if upgrading PEAR didn't work or it did work butwrote:theninstaller still says there are no package.xml 2.0 handlerssomehting is wrong. What happens when you do: pear upgrade -a PEAROn 10/18/06, Justin Patrin < papercrane@gmail.com >wrote:On 10/18/06, Paula Fether < gridzmaster@gmail.com>dohandlersI tried the install again and saw the message "Noforpackage.xmlversion 2.0" but I don't think that has anything towithtoMail,doesit?The first lines of the install are Starting to download Mail-1.1.14.tgz (17,537 bytes) ......done: 17,537 bytes downloading Net_SMTP- 1.2.8.tgz ... So maybe it's downloaded but not installed?Did you do the upgrade-all as I asked before? You needdatawrote:updateyourPEAR package.On 10/18/06, Justin Patrin < papercrane@gmail.com >wrote:On 10/18/06, Paula Fether < gridzmaster@gmail.com>buildListing of /usr/lib/php isArchive Net PEAR.phppearcmd.phpConsole OS System.phpXMLtestHTML PEARpapercrane@gmail.com>docso apparently Mail.php wasn't installed.Sounds like pear install -a Mail sisn't work....On 10/18/06, Justin Patrin <gridzmaster@gmail.comwrote:On 10/18/06, Paula Fether <theEvenwrote:Done, also added some more paths. No change.rememberedtorestartApache again. The new paths do show up inerrorthere?Mail.phpmessage,sothechangesare taking effect, but it still can't findDid you look to see if Mail.php is actuallyphp.inipapercrane@gmail.com >Did you ge it installed via the pear command?On 10/18/06, Justin Patrin <gridzmaster@gmail.comwrote:On 10/18/06, Paula Fether <wrote:That's weird. Phpinfo now shows thepathpathas/private/etc/php.ini.There must be another place where theisApache,papercrane@gmail.com >stored,I'mguessing.Try editing that file then.On 10/18/06, Justin Patrin <gridzmaster@gmail.com>wrote:On 10/18/06, Paula Fether <wrote:Saved file as php.ini, restartedproblem?stillnoworky.You still get the file not foundRunphp.iniphpinfo();again(onyour webserver) and look at theandis inpapercrane@gmail.cominclude_pathvalues.Arethey what you expect?On 10/18/06, Justin Patrin <gridzmaster@gmail.comwrote:On 10/18/06, Paula Fether </usr/lib/phpwrote:pear config-show says php_dir isphpinfo() says php.ini.defaultprogramun-commented/etcfound php.ini.default andtheUnixinclude_path,thenadded/usr/lib/php saved php.ini.default but my(include_path='.:/usr/lib/php')path instillcan'tfindMail.phpSo I'm guessing I didn't add thephpinfo()therightplace, orIneedtosavethe file as php.ini?It needs to be named exactly asshouldsays.The.defaultversionjust has the defaults in it. Youapache.copyit tophp.iniandchangeit there. Then you need to restartMail.php:papercrane@gmail.com >On 10/18/06, Justin Patrin <gridzmaster@gmail.com>wrote:On 10/18/06, Paula Fether <wrote:Done, but it can't findfailed toWarning: main( Mail.php):/Users/paulafether/Sites/gui4me.com/Temail.phpopenstream: Nosuchfileordirectoryinopeningonline 2Fatal error: main(): Failedrequired 'Mail.php 'in/Users/paulafether/Sites/gui4me.com/Temail.phpYouonline2Do: pear config-show and look for the php_dir line.Toneed toaddthatpathtoyourinclude_path in your php.ini .findforyourphp.ini,putthisin ascript (at the top) and lookusing:Terminalphp.ini:phpinfo();Doing "which Mail.php " inalsocommands, socomesupempty."which" is for finding binarythatwon'tworkforthesekind of files. You can try<updatedlocate Mail.php but the locate database isn'trightawayandpapercrane@gmail.com >maynotfindituntil updatedb is re-run.On 10/18/06, Justin Patrin <wrote:On 10/18/06, Paula Fetheris:Mail-1.1.14.tgzgridzmaster@gmail.comwrote:It downloadedandNet_SMTP- 1.2.8.tgz,thensaidFirst thing you should doagainpear list-upgrades then pear upgrade-all Once that's done, lookat:Net_SMTPpear help install You want pear install -a Mail`Auth_SASL'`Net_Socket'requires packagerequires packagedirectoryfailedNet_SMTP: Dependenciessettings:Here are the configPEAR executablesdirectorybin_dir/usr/binPEAR documentationdoc_dir/usr/lib/php/docPHP extensiondirectory ext_dir
directoryphp_dirPEAR directory/usr/lib/phpPEAR Installer cache
php_bincache_dir/tmp/pear/cachePEAR datadirectory data_dir/usr/lib/php/dataPHP CLI/CGI binary
/usr/bin/phpPEAR test
directory test_dir/usr/lib/php/test
cache_ttlCache TimeToLive
umaskpreferred_state3600Preferred Package StatestableUnix file mask
Address22Debug LogLevel verbose1HTTP Proxy Server
Programhttp_proxypasswordmaster_server<notset>PEAR serverpear.php.netPEAR password (for<notset>maintainers) Signature Handling
Patrin <sig_binsig_keyidsig_keydir/usr/local/bin/gpgSignature Key Directory/private/etc/pearkeysSignature Key Idsig_type<notset>Package Signature TypeusernamegpgPEAR username (for<notset>maintainers) On 10/18/06, Justin
Fetherpapercrane@gmail.com >wrote:On 10/18/06, Paula
<12:06messagegridzmaster@gmail.com>wrote:---------- Forwarded----------gridzmaster@gmail.com >From: Paula Fether <Date: Oct 18, 2006
PMneedSubject: Re: [PEAR]
forhelppapercrane@reversefold.comwithusingMail.phpTo:Hi Justin, thanks
thephpquickresponse.PEAR came with my
wasinstallation,so Ithoughteverythingwasalreadyhere. That's why I
put itsurprisedthat itcouldn'tfindMail.php.SoIjustdownloaded it and
inPEARthedirectorywithmysite.So Iguess Ineed todownload the whole
topackageanddoaninstallthen?Ifso,arethereanyprecautions I need
takethingstype:concerningotherprogramsthatuseit?Open up a terminal andpear help Then use it to do
like:Net_SMTPpear install Mail
errorAlso I do have an
yourhandlingroutinewhencallingMail,butitdoesn'tseemtoget there.Did you try the errormethodsonmywiki?Thanks again for
help.!path toproblemsPS: I've had otherwithpaths,maybethisisanotherone. Ihadtomanually add the
inmysqldumpinTerminal(macosx),andthenappendthe PATH statement
php in'pear'orderto domysqldumpfromthere.It's possible that
PHPisn't inyourpath.Trytheaboveandsee ifit is. include_path in
istoPatrin <different.On 10/18/06, JustinFetherpapercrane@gmail.com >wrote:On 10/18/06, Paula<gridzmaster@gmail.comwrote:Hi, I'm trying
sendnoticedsimpleemailsfrom awebsite.Iusedtojustuse"mail()" but
aboutthat ifsomeonereadstheheaderstheycanseeinformation
thecouldn'twebhostthatI'drathernotsend,so ItriedMail.php.At first it
code:findtheprogram soIdownloadedit.Then Iwrotethefollowing test
= "Mail.php<?php require_once ""; //usePEAR$recipients
= "you@mail.com ";$headers["From"]
=me@mail.com";$headers["To"]
$headers["Subject"]"you@mail.com";
=$params["username"]testing"testwithremotehost";$body = "just= "somemorenow";$params["host"]=mail.me.com";$params["port"]="25";$params["auth"]true;
$params["password"]= "owner@me.com ";
echo("<p>Message=(PEAR::isError($mail_object))"mypassword";&Mail::factory("smtp",$mail_object =Mail::send($recipients,$params);$mail_object =$headers,$body);if{$mail_object->getMessage()echo("<p>" .."</p>");}else{
errorsuccessfullysent!</p>");}?> But it gives the"*Fatal*/mypath.com/Mail.php*error*:Callto amemberfunctiononanon-object inonline*90*".That's where
callsvia"functionsend($recipients,$headers,$body)".Help please?A few things: 1) Did you install
thedbePEARinstallerorbymanuallycopyingthefile? You shoul
usingcheckingtheNet_SMTP?PEARinstaller.2) Did you installThesmtpbackendtorequiresthispackage as well. 3) Are you
forhttp://pear.reversefold.com/dokuwiki/doku.php?id=phpfaqs#what_does_call_to_undefined_method_xxxxxx_meancausingerrorsbeforeusinyourobject?Likelytheabove problems areanerror tobereturned.See:
-- Justin Patrin -- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin-- Justin Patrin