Send mail using Mail.php / PEAR

To send mail using Mail.php, PEAR and a .user.ini with the path to PEAR need to be uploaded to the site.  Instructions are included below to manually install PEAR.  If you require assistance with installing PEAR, please open a ticket with the Support Department.
 
 
Download PEAR.zip
 
 
Inside the .zip is the PEAR directory, which contains a web.config to prevent browser access, a test script zsend.php, and both a .user.ini and user.ini.  For PHP 5.3, "user.ini" is used.  For all other versions of PHP, ".user.ini" is used.  For brevity, the steps below always reference the latter.
 
 
Update and upload .user.ini and PEAR directory
 
If the site has an existing .user.ini, it will need to be updated with the server path to the PEAR directory.  If the site does not have a .user.ini, the example file included in PEAR.zip may be used after replacing "FTPusername" with the FTP username for your site account.
 
For reference, the Path to root is found in the Site Info pane of the Winhost Control Panel.
 
 
Upload the /PEAR directory and the updated .user.ini to the document root of the site to use Mail.php.
 
 
Testing Mail.php
 
zsend.php may be used to test Mail.php.  First update the settings in the script highlighted in red below.
 
<html>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "Mail.php";
$from = "Sender <postmaster@domain.com>";
$to = "Recipient <postmaster@domain.com>";
$subject = "Mail.php test email";
$body = "Test email sent using Mail.php.";
$host = "m##.internetmailserver.net";
$username = "postmaster@domain.com";
$password = "password";
$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
  'auth' => true,
  'username' => $username,
  'password' => $password));
$mail = $smtp->send($to, $headers, $body);
echo "Mail.php test"
?>
</html>
 
After updating, save the changes and upload the script to the site.  View the page in a browser and you should see "Mail.php test" returned.  If the email is not received, review the path to PEAR in the .user.ini and/or the zsend.php settings.
 
To prevent abuse, zsend.php should be deleted from the site after testing.