1
votes

Ok here is the issue. I send an html email to my users.

I can't just send content text/html html in my headers because my host don't like it! They suggested to use SMTP.

So I had to install Pear id did. Then I had to install the Mail extension. I did. Now I grab a code from the web to try it out and I get the error message

Fatal error: Class 'Mail' not found in /home/alain/php/Mail/mail.php on line 51

I'm calling that file with a require_once();. Now the line 51 in mail.php is

class Mail_mail extends Mail {

Its only the class statement!! The installation is brand new. The host use Cpanel

3

3 Answers

6
votes

I found out that by default the Ubuntu's php-pear does not include the PEAR::Mail package. It's easily fixable, though:

pear install Mail
pear install pear/Net_SMTP 
pear install pear/Auth_SASL

If that does not work, you might want to check your PEAR installation, by following this guide: http://pear.php.net/manual/en/installation.checking.php

1
votes

You need to require() the file that has the Mail class, otherwise your Mail_mail class has nothing to extend.

0
votes

There is a mistake in the mail.php.

firstly make sure you require('../php/Mail/mail.php) before doing any email coding.

Then open up the php/Mail/mail.php and put the following code in before the first class:

require('../php/Mail.php')

for some reason the coding in the hasnt included this and the class Mail it extends cannot be reached.