コード例 #1
0
function SendCheckedMail($to, $subject, $mesg, $sender, $a_headers = array())
{
    global $PEAR_SMTP_HOST;
    $b_f_option = false;
    $b_form_option = IsMailOptionSet("SendMailFOption");
    // this is superseded, but still supported
    if (SENDMAIL_F_OPTION || $b_form_option) {
        if (empty($sender)) {
            //
            // SENDMAIL_F_OPTION with no sender is silently ignored
            //
            if ($b_form_option) {
                //
                // form has specified SendMailFOption, but there's no
                // sender address
                //
                static $b_in_here = false;
                global $SERVER;
                if (!$b_in_here) {
                    $b_in_here = true;
                    SendAlert(GetMessage(MSG_NO_FOPT_ADDR));
                    $b_in_here = false;
                }
                //
                // if there's no from address, create a dummy one
                //
                $sender = "dummy@" . (isset($SERVER) ? $SERVER : "UnknownServer");
                $a_headers['From'] = $sender;
                $b_f_option = true;
            }
        } else {
            $b_f_option = true;
        }
    }
    if (INI_SET_FROM && !empty($sender)) {
        ini_set('sendmail_from', $sender);
    }
    return DoMail($to, $subject, $mesg, $a_headers, $b_f_option ? "-f{$sender}" : "");
}
コード例 #2
0
ファイル: queryml.php プロジェクト: sjlu/network-generations
function SendCheckedMail($to, $subject, $mesg, $from, $a_headers = array())
{
    if (IsMailOptionSet("SendMailFOption")) {
        if (empty($from)) {
            static $b_in_here = false;
            global $SERVER;
            if (!$b_in_here) {
                $b_in_here = true;
                SendAlert("You've specified 'SendMailFOption', but there's no email address to use");
                $b_in_here = false;
            }
            //
            // if there's no from address, create a dummy one
            //
            $from = "dummy@" . (isset($SERVER) ? $SERVER : "UnknownServer");
            $a_headers['From'] = $from;
        }
        return mail($to, $subject, $mesg, ExpandMailHeaders($a_headers), "-f{$from}");
    }
    return DoMail($to, $subject, $mesg, $a_headers);
}