コード例 #1
0
ファイル: functions.php プロジェクト: ECP-Black/ECP
function send_email($to, $title, $content, $html = 0, $from = '', $fromname = '')
{
    if (!defined('DISPLAY_XPM4_ERRORS')) {
        define('DISPLAY_XPM4_ERRORS', false);
    }
    // display XPM4 errors
    error_reporting(E_ALL);
    $m = new XMail();
    // set from address and name
    if ($from) {
        $m->From($from, $fromname);
    } else {
        $m->From(SITE_EMAIL, SITE_EMAIL_NAME);
    }
    // add to address and name
    $m->AddTo($to);
    // set subject
    $m->Subject($title);
    if ($html) {
        $m->Html($content);
    } else {
        $m->Text($content);
    }
    if (SMTP_AKTIV) {
        $c = $m->Connect(SMTP_HOST, (int) SMTP_PORT, SMTP_USER, SMTP_PASS, 'tls', 10, 'localhost', null, 'plain');
        //or die(print_r($m->Result));
    }
    return $m->Send(SMTP_AKTIV ? $c : null);
}