Search code examples
phppear

pear: using mail and mime packages


I've been using pear mail package 1.20 to send plan text email.

I have downloaded the main-mime packages 1.8.1 so that i can send html email.

I've included them:

  require_once(BASE_PATH.'/PearMail/Mail-1.2.0/Mail.php');
  require_once(BASE_PATH.'/PearMail/Mail_Mime-1.8.1/mime.php');

When I sent out email, I receive the following error:

Fatal error: Call to undefined method Mail_mimePart::encodeHeader() in E:\xampp\htdocs\bookywood\bookywood\application\ExtLib\PearMail\Mail_Mime-1.8.1\mime.php on line 1322

What am i missing here?


Solution

  • If you want a very nice plug-in HTML/MIME mailer, then I highly recommend HTML Mime Mail. You can use a simple require/include in your code and it can be put anywhere. It doesn't rely on any other PEAR, PECL, or PHP files. You can use the system PHP mailer, or specify information for an SMTP server. The example files show HTML e-mail with attachments, so you can easily have complex e-mail processed properly.

    For your specific error message, it looks like your downloaded PEAR code is relying on other PEAR modules that can't be found because of the location you've put your module files. Since you're using XAMPP, why not use the PEAR batch file and include all the modules that way? Then you'll know all the requirements are fulfilled and your code will work.