开发者

PHP SMTP Mail class issue

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 s开发者_如何学Ctatement!! The installation is brand new. The host use Cpanel


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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜