0
votes

I am trying to install Pear Mail on my MAMP local host.

MAMP VERSION 2.2 PHP Version 5.5.3 Latest Pear Version 1.2.0

I am creating a small app to send email, and I want to use PEAR mail SMTP within my app to process and send Mail. I get this error:

Fatal error: Class 'Mail' not found in /Applications/MAMP/htdocs/appTest/Mail.php on line 20

To install PEAr Mail it self I used TERMINAL with this command:

cd Applications/MAMP/bin/php5.5.3/bin/pear install -a Maill-1.2.0

Before executing this command I also used sudo su to get all admin rights to instal package.

after running the install command in the terminal there was no error and the terminal just jumped to the next line which I assume the installation was successful.

But when I checked the folder in which I installed the Pear Mail package I didn't see as if anything was installed at all and the error message I get seems to confirm this.

Is there anything I have missed out on during the installation..?

Regards

1

1 Answers

1
votes

You might need to adjust your include_path. First check what directory the Mail package got installed to:

Applications/MAMP/bin/php5.5.3/bin/pear list Mail

You might see something similar to this:

INSTALLED FILES FOR MAIL
========================
TYPE INSTALL PATH
php  /usr/share/php/Mail/mail.php
php  /usr/share/php/Mail/mock.php
php  /usr/share/php/Mail/null.php
php  /usr/share/php/Mail/RFC822.php
php  /usr/share/php/Mail/sendmail.php
php  /usr/share/php/Mail/smtp.php
php  /usr/share/php/Mail/smtpmx.php
test /usr/share/php/test/Mail/tests/9137.phpt
test /usr/share/php/test/Mail/tests/9137_2.phpt
test /usr/share/php/test/Mail/tests/13659.phpt
test /usr/share/php/test/Mail/tests/rfc822.phpt
test /usr/share/php/test/Mail/tests/smtp_error.phpt
test /usr/share/php/test/Mail/tests/validateQuotedString.php
php  /usr/share/php/Mail.php

Then, set your include_path directive to include the directory that you see Mail.php in:

In PHP Code:
ini_set('include_path', get_include_path() . PATH_SEPARATOR . '/usr/share/php/');

Or

In php.ini:
include_path = ".:/Applications/MAMP/includes:/usr/share/php"