php-pear mail
I am using this script below on the server using Mail.php as an include from /usr/share/pear/ directory and i am getting the emails. Any idea on how I can re-code the WA_globals.php or/and the mail_PHP.php in order to use the same method to send emails using the User Registration Solution Pack and pear(Mail.php)?
<?php
require_once "Mail.php";
$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_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);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
Obviously I want to use the solution pack and email is important for authentication, lost password etc.. so therefore I will require your assistance to work out a solution. Please Advise.
Information gathered from:
howto-php-send-email-via-smtp-authentication.html
PHP_Email_SMTP_Authentication.htm