Send mail using Mail.php / PEAR

To send mail using Mail.php, PEAR will have to be uploaded to the site.  If you would like to manually install PEAR, find the instructions below.  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, a .user.ini, a test script named zsend.php and a script to show the server path to /PEAR named zpath.php.  The PEAR directory also contains a web.config to prevent browser access to the subdirectory.
 
To use Mail.php, upload the /PEAR directory and the .user.ini to the document root of the site ( /site/wwwroot/ ).  If you have an existing .user.ini, update it with the include_path to /PEAR.
 
 
Testing Mail.php
 
zsend.php may be used to test whether Mail.php has been properly set up.  Open the file in a text editor and update the settings highlighted in red below.
 
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "Mail.php";
$from = "[email protected]";
$to = "[email protected]";
$subject = "Mail.php test email";
$body = "Test email sent using Mail.php.";
$host = "sm##.internetmailserver.net";
$username = "[email protected]";
$password = "password";
$headers = array ('Date' => date('r'),
  'From' => $from,
  'To' => $to,
  'Subject' => $subject,
  'Message-ID' => '<' . time() . md5($from . $to) . '@domain.com>');
$smtp = Mail::factory('smtp',
  array ('localhost' => $host,
  'host' => $host,
  'auth' => true,
  'username' => $username,
  'password' => $password));
$mail = $smtp->send($to, $headers, $body);
echo "Mail.php test"
?>
 
Once updated, 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, the path to PEAR in the user.ini and/or the zsend.php settings should be reviewed.  For the former, see the next section.
 
To prevent abuse, zsend.php should be deleted from the site after testing.