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.
![](https://iamshishir.com/wp-content/uploads/2019/03/image-16.png)
Command Prompt will open up which will look similar to the following.
![](https://iamshishir.com/wp-content/uploads/2019/03/image-13.png)
Past or type the following command that wil automatically download and install the package for you.
pear install -a Mail
![](https://iamshishir.com/wp-content/uploads/2019/03/image-14.png)
Once you typed, press enter to execute the command.
Once the execution is over you will see the result similar to following screenshot.
![](https://iamshishir.com/wp-content/uploads/2019/03/image-15.png)
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.
Leave a Reply
You must be logged in to post a comment.