this is how i did it on my linux box
# yum install php-pear
# pear install --alldeps Mail-1.2.0
2. to use mail in php:
// email settings
require_once "Mail.php";
$username = "<gmail email address here>@gmail.com";
$password = "<gmail email password here>";
$from = "<gmail email address here>@gmail.com";
$host = "ssl://smtp.gmail.com";
$port = "465";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory(
'smtp',
array(
'host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password
)
);
$mail = $smtp->send($to, $headers, $message);
if(PEAR::isError($mail))
{
$resultstring = "email sending error: " . $mail->getMessage();
}
else
{
$resultstring = "email sent to $to";
}
No comments:
Post a Comment