28 lines
593 B
PHP
28 lines
593 B
PHP
<?php
|
|
require_once "Mail.php";
|
|
function send_mail($to, $subject, $body)
|
|
{
|
|
$from = getenv("SMTP_FROM");
|
|
$subject = "[Aircraft Dev Registry] " . $subject;
|
|
$host = getenv("SMTP_HOST");
|
|
$username = getenv("SMTP_USER");
|
|
$password = getenv("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))
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
?>
|