aircraft-dev-registry/www/common.php
fly ff3d23195a Initial Commit
Signed-off-by: fly <merspieler@airmail.cc>
2021-06-03 22:24:25 +02:00

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;
}
}
?>