Making Pear:Mail Package to work on Xampp

Are you receiving an error when you are trying to send mail through PHP using Pear Mail module. Similar to how it is shown below.


Warning: require_once(Mail.php): failed to open stream: No such file or directory in C:\xampp\htdocs\mailtest.php on line 2

Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\mailtest.php on line 2

We can fix this my installing the PEAR::Mail on your Xampp..

What is Pear::Mail package?

Class that provides multiple interfaces for sending emails

How to install the PEAR::Mail on your Xampp.

Command Prompt will open up which will look similar to the following.

Past or type the following command that wil automatically download and install the package for you.

pear install -a Mail

Once you typed, press enter to execute the command.

Once the execution is over you will see the result similar to following screenshot.

Now to send SMTP Mail is installed.
If you want to sent out emails in HTML format. I recommend to install the following two packages as well.
Just type and press enter again.

pear install -a Mail_Mime
pear install -a Net_SMTP

Once you run these you are all set to use Pear::Mail in your code. ?

To learn about how to send emails using SMTP account from PHP Read this post.


Comments

Leave a Reply