33 lines
778 B
PHP
33 lines
778 B
PHP
|
<?
|
||
|
|
||
|
function sendMail($from, $to, $subject, $text='', $html='', $priority='high', $tabImgFiles=array(), $tabAttachedFiles=array())
|
||
|
{
|
||
|
|
||
|
require_once("Mail.php");
|
||
|
|
||
|
$headers["From"] = $from;
|
||
|
$headers["To"] = $to;
|
||
|
$headers["Subject"] = $subject;
|
||
|
|
||
|
$body = $text;
|
||
|
|
||
|
$params["host"] = SMTP_HOST;
|
||
|
$params["port"] = SMTP_PORT;
|
||
|
if (SMTP_USER=='' && SMTP_PASS=='')
|
||
|
$params["auth"] = false;
|
||
|
else {
|
||
|
$params["username"] = SMTP_USER;
|
||
|
$params["password"] = SMTP_PASS;
|
||
|
}
|
||
|
|
||
|
// Create the mail object using the Mail::factory method
|
||
|
$mail_object = Mail::factory("smtp", $params);
|
||
|
|
||
|
$mail_object->send($to, $headers, $body);
|
||
|
|
||
|
if (PEAR::isError($mail_object))
|
||
|
return $mail_object->getMessage();
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
?>
|