Consequently, when you try to install PEAR Mail for MAMP with the command /Applications/MAMP/bin/php5.3/bin/pear install -a Mail it is trying to install Mail in /usr/local/PEAR. The php_dir setting in ~/.pearrc appears to always take priority over that in the nf file. In your case this setting is /usr/local/PEAR which corresponds to the Mac OS X install. However, all three installs share a single PEAR user configuration file named ~/.pearrc which also contains a php_dir setting. This file contains the php_dir setting which is different for each install. Each install has its own individual PEAR system configuration file named nf. You have three PEAR installs: Mac OS X, MAMP and XAMPP. It’s enough to drive you insane, isn’t it! Require_once “/Applications/MAMP/bin/php5/lib/php/Mail.php” Second, SMTP.php itself is requiring Socket.php as a dependency but the relative path is wrong so you must EDIT that SMTP.php file by changing the line…įinally, you can now require your Mail.php file BUT IT ALSO MUST SPECIFY THE EXACT PATH… Require_once “/Applications/MAMP/bin/php5/lib/php/Net/SMTP.php” So, BEFORE you try to “require_once” the Mail.php file you must first require_once the SMTP.php file but you MUST USE THE EXACT PATH… Applications/MAMP/bin/php5/lib/php/Net/SMTP.php NOT SO… there seems to be THREE more issues.įirst, Mail.php is dependent on Net_SMTP, which is really a file called SMTP.php located here… Applications/MAMP/bin/php5.3/bin/pear config-get php_dirĪt this point one would think, with the correct path… things would work correctly. Applications/MAMP/bin/php5.2/bin/pear config-get php_dir Indeed, following Steve’s advice in his Feb 16 post I reset the path so these terminal commands… OK… Steve got close but with his help I was able to figure this out. If you don’t use virtual hosts, simply point your browser to THERE IS MORE TO THE STORY… If successful, you should receive an email.ġ This example assumes you have configured a virtual host in either MAMP or XAMPP for mysite called local.mysite. $mail = $smtp->send($recipient, $headers, $body) Identify the mail server, username, password, and port $body = "PEAR Mail successfully sent this email." You’ll need to change the values for $sender, $recipient, $server, $username, $password and optionally $port to match your email configuration. In this example I’ll save the file as PEARMailTest.php in the root directory of mysite. To ensure you can send an email, copy the code below and save it as a file in the root directory of your site. For example, the Mail_Queue package requires Mail, and Net_Socket is also required by the Net_POP3 and HTTP_Request packages to name but two. Unlike the package installation in MAMP, I’d not recommend uninstalling Mail and its dependencies in XAMPP because of the other PEAR packages that are pre-installed. To ensure the installation was successful and you can send mail see Sending a Test eMail. The relevant directories are located in the /Applications/XAMPP/xamppfiles/lib/php/pear/ directory: Auth, Mail and Net. To force the upgrade of Mail and its dependencies change the -a flag to -af. These are currently Auth_SASL, Net_SMTP and Net_Socket. The -a flag ensures that Mail‘s dependencies are also upgraded. Not doing so will result in the upgrade failing. Note that we need to prefix the command with sudo. Sudo /Applications/XAMPP/xamppfiles/bin/pear upgrade -a Mail
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |