PEAR::Mail on XAMPP for Windows

How to install the PEAR::Mail package (class) on XAMPP for Windows

What is PEAR::Mail?

"Mail" is a class that provides multiple interfaces for sending emails.
Source: https://pear.php.net/package/Mail

PEAR::Mail Installation on XAMPP for Windows

First run the XAMPP Control Panel and click on "Shell":

 

XAMPP for Windows Control Panel - run Shell

 

Type in the following code in the XAMPP Shell window:

pear install -a Mail

 

Install PEAR::Mail on XAMPP for Windows

 

Hit Enter to start the installation:

 

PEAR::Mail Installation

 

The option -a has automatically installed all other required packages.
The installation is done ... you can close the XAMPP for Windows shell.

 

If you get the error:
PHP Fatal error: Cannot use result of built-in function in write context in C:\xampp\php\pear\Archive\Tar.php on line 639

Open the file Tar.php in your text editor and scroll to line 639.

Change line 639 in Tar.php from:
v_att_list = & func_get_args();
to
v_att_list = func_get_args();
(remove the & so that func_get_args won't be called by reference)

Save the Tar.php and run "pear install -a Mail" again.

Test if PEAR::Mail is installed

You can test if PEAR and PEAR::Mail is installed using a simple php test file.
(Requires php 5.3.2 or php 7++)

 

File: test-pear-mail.php

<?php

if (!stream_resolve_include_path('System.php'))
{
    echo"PEAR not installed :(";
}
else
{
    echo"PEAR installed: ";
    echo stream_resolve_include_path('System.php');
}

if (!stream_resolve_include_path('Mail.php'))
{
    echo"\nPEAR::Mail not installed :(";
}
else
{
    echo"\nPEAR::Mail installed!: ";
    echo stream_resolve_include_path('Mail.php');
}

?>

 

How it works:

The function "stream_resolve_include_path" resolves a filename against the include path.
It returns the path or false if the file was not found.
The file "System.php" contains the PEAR class and "Mail.php" the PEAR::Mail class.

Disclaimer: The information on this page is provided "as is" without warranty of any kind. Further, Arclab Software OHG does not warrant, guarantee, or make any representations regarding the use, or the results of use, in terms of correctness, accuracy, reliability, currentness, or otherwise. See: License Agreement