当前位置: 首页>>代码示例>>PHP>>正文


PHP Mail_mime::setSubject方法代码示例

本文整理汇总了PHP中Mail_mime::setSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail_mime::setSubject方法的具体用法?PHP Mail_mime::setSubject怎么用?PHP Mail_mime::setSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mail_mime的用法示例。


在下文中一共展示了Mail_mime::setSubject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wifidog_register_perform


//.........这里部分代码省略.........
    }
    if ($ENABLED_SMTP == 0) {
        $autocreate_confirmed = 1;
    }
    if ($GLOBALS["HOTSPOT_DEBUG"]) {
        wifidog_logs("Create new member {$email},{$password},TTL:{$ArticaSplashHotSpotEndTime}", __FUNCTION__, __LINE__);
    }
    $sql = "INSERT IGNORE INTO hotspot_members \n\t(uid,username,token,ruleid,ttl,sessiontime,password,enabled,creationtime,autocreate,autocreate_confirmed,autocreate_maxttl,sessionkey,MAC) VALUES\n\t('{$email}','{$email}','{$token}','{$_SESSION["WIFIDOG_RULES"]}','{$ArticaSplashHotSpotEndTime}','','{$password}',1,'{$creationtime}',1,'{$autocreate_confirmed}',{$autocreate_maxttl},'{$sessionkey}','{$MAC}')";
    $q->QUERY_SQL($sql);
    wifidog_logs("[{$ARP}]:[{$GLOBALS["CONNECTED_IP"]}]: {$email}: Create New member with a token {$token}", __FUNCTION__, __LINE__);
    if (!$q->ok) {
        events(0, "MySQL error: {$q->mysql_error} (Line: " . __LINE__ . ")");
        wifidog_logs("{$q->mysql_error}");
        wifidog_logs("{$sql}");
        return wifidog_register($q->mysql_error);
    }
    if ($ENABLED_SMTP == 0) {
        $array["SERVER_NAME"] = $_SERVER["SERVER_NAME"];
        $array["redirecturi"] = $url;
        $array["LOGIN"] = $email;
        $array["redirecturi"] = $_REQUEST["url"];
        $array["REMOTE_ADDR"] = $_REQUEST["ip"];
        $array["token"] = $token;
        $array["HOST"] = $_REQUEST["ip"];
        $array["ruleid"] = $_SESSION["WIFIDOG_RULES"];
        UnLock($array);
        wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
        $_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
        $_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
        $redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
        wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
        header("Location: {$redirecturi}");
        return;
    }
    $proto = "http";
    $myHostname = $_SERVER["HTTP_HOST"];
    $page = CurrentPageName();
    if (isset($_SERVER["HTTPS"])) {
        $proto = "https";
    }
    $URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm={$sessionkey}";
    $smtp_sender = $sock->GET_INFO("smtp_sender");
    include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
    $message = new Mail_mime("\r\n");
    $text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p>\n\t<p>\t\n\t<hr>\n\t\t<center>\n\t\t\t<a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a>\n\t\t</center>\n\t</p>";
    $message->setFrom($smtp_sender);
    $message->addTo($email);
    $message->setSubject($wifidog_templates->REGISTER_SUBJECT);
    $message->setTXTBody(strip_tags($text));
    $message->setHTMLBody($text);
    $finalbody = $message->getMessage();
    $webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $email);
    if (!$webauth_msmtp->Send()) {
        events(0, "SMTP Error[method 1]: {$webauth_msmtp->logs}", $webauth_msmtp->logs);
        $content[] = "Method 1:\n{$webauth_msmtp->logs}\n";
        $smtp = new smtp();
        if ($sock->GET_INFO("smtp_auth_user") != null) {
            $params["auth"] = true;
            $params["user"] = $sock->GET_INFO("smtp_auth_user");
            $params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
        }
        $params["host"] = $sock->GET_INFO("smtp_server_name");
        $params["port"] = $sock->GET_INFO("smtp_server_port");
        if (!$smtp->connect($params)) {
            $content[] = "Method2 Error:{$smtp->error_number} {$smtp->error_text}";
            events(0, "SMTP Error[method 2 - Connect]: {$params["host"]} {$smtp->error_number} {$smtp->error_text}", @implode("\n", $content));
            return wifidog_register("{$email}: {error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
        }
        if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $email, "body" => $finalbody, "headers" => null))) {
            events(0, "SMTP Error[method 2 - Send]: {$smtp->error_number} {$smtp->error_text}", null);
            $smtp->quit();
            return wifidog_register("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}");
        }
        if ($GLOBALS["HOTSPOT_DEBUG"]) {
            wifidog_logs("From: {$smtp_sender} to {$email} {$wifidog_templates->REGISTER_SUBJECT} success");
        }
        $smtp->quit();
    }
    if ($GLOBALS["HOTSPOT_DEBUG"]) {
        wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Token: {$token} -> UnLock(..");
    }
    $array["LOGIN"] = $email;
    $array["ARP"] = $_REQUEST["mac"];
    $array["token"] = $token;
    $array["redirecturi"] = $_REQUEST["url"];
    $array["REMOTE_ADDR"] = $_REQUEST["ip"];
    $array["REGISTER"] = true;
    if (!UnLock($array)) {
        if ($GLOBALS["HOTSPOT_DEBUG"]) {
            wifidog_logs("wifidog_auth/" . __FUNCTION__ . "::failed_to_create_session");
        }
        return wifidog_register("{error} {failed_to_create_session}");
    }
    wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: SESSION(HOTSPOT_REDIRECT_URL) = {$url}");
    $_SESSION["HOTSPOT_AUTO_REGISTER"] = true;
    $_SESSION["HOTSPOT_REDIRECT_URL"] = $url;
    $redirecturi = "http://{$gateway_addr}:{$gw_port}/wifidog/auth?token={$token}";
    wifidog_logs("wifidog_auth/" . __FUNCTION__ . ":: Redirect Token: {$token} to {$redirecturi}");
    header("Location: {$redirecturi}");
}
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:hotspot.php

示例2: mail

 static function mail($subject, $txt_body, $to_email, $to_name = "", $html_body = "", $text_charset = "UTF-8", $html_charset = "UTF-8", $head_charset = "UTF-8", $text_encoding = "8bit", $html_encoding = "quoted-printable")
 {
     $mime = new Mail_mime("\n");
     $mail = Mail::factory("mail");
     if (!empty($to_name)) {
         $to = "{$to_name} <{$to_email}>";
     } else {
         $to = $to_email;
     }
     $subject = self::mb_mime_header($subject, $head_charset);
     $headers = array("From" => Config::get('email-user') . ' <' . Config::get('email-from') . '>', "Reply-To" => Config::get('email-from'), "Return-Path" => Config::get('email-from'));
     $sig = Config::get('email-signature', '');
     if (!empty($sig)) {
         $txt_body .= "\n\n-- \n" . $sig . "\n";
     }
     $mime->setTXTBody(Utils::linewrap($txt_body));
     $mime->setSubject($subject);
     if (!empty($html_body)) {
         $mime->setHTMLBody($html_body);
     }
     $body = $mime->get(array('text_charset' => $text_charset, 'html_charset' => $html_charset, 'head_charset' => $head_charset, 'text_encoding' => $text_encoding, 'html_encoding' => $html_encoding));
     $headers = $mime->headers($headers);
     $rcpt = $to;
     $mail->send($rcpt, $headers, $body);
 }
开发者ID:BackupTheBerlios,项目名称:phphoto-svn,代码行数:25,代码来源:Utils.php

示例3:

// Check if we have an access token ready for API calls
try {
    if (isset($_SESSION['access_token']) && $client->getAccessToken()) {
        // Make API Calls
        if (isset($_POST['send'])) {
            $to = $_POST['to'];
            $bcc = $_POST['bcc'];
            $cc = $_POST['cc'];
            $body = $_POST['message'];
            $subject = $_POST['subject'];
            $mime->addTo($to);
            $mime->addBcc($bcc);
            $mime->addCc($cc);
            $mime->setTXTBody($body);
            $mime->setHTMLBody($body);
            $mime->setSubject($subject);
            $message_body = $mime->getMessage();
            $encoded_message = base64url_encode($message_body);
            // Gmail Message Body
            $message = new Google_Service_Gmail_Message();
            $message->setRaw($encoded_message);
            // Send the Email
            $email = $service->users_messages->send('me', $message);
            if ($email->getId()) {
                $notice = '<div class="alert alert-success">Email Sent successfully!</div>';
            } else {
                $notice = '<div class="alert alert-danger">Oops...something went wrong, try again later</div>';
            }
        } else {
            if (isset($_POST['draft'])) {
                $to = $_POST['to'];
开发者ID:veslo1,项目名称:gmail-php-starter,代码行数:31,代码来源:gmail.php

示例4: tests_smtp

function tests_smtp()
{
    //ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
    include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
    header("content-type: application/x-javascript");
    $sock = new sockets();
    $sock = new wifidog_settings($_GET["ruleid"]);
    $wifidog_templates = new wifidog_templates($_GET["ruleid"]);
    $ArticaSplashHotSpotEndTime = $sock->GET_INFO("ArticaSplashHotSpotEndTime");
    $proto = "http";
    $myHostname = $_SERVER["HTTP_HOST"];
    $page = CurrentPageName();
    if (isset($_SERVER["HTTPS"])) {
        $proto = "https";
    }
    $URL_REDIRECT = "{$proto}://{$myHostname}/{$page}?wifidog-confirm=NONE";
    $tpl = new templates();
    $smtp_sender = $sock->GET_INFO("smtp_sender");
    if ($GLOBALS["VERBOSE"]) {
        echo "new Mail_mime....<br>\n";
    }
    include_once dirname(__FILE__) . "/ressources/externals/mime/mime.inc";
    $message = new Mail_mime("\r\n");
    $text = "<p style=font-size:18px>{$wifidog_templates->REGISTER_MESSAGE}</p><p>\n\t<hr><center><a href=\"{$URL_REDIRECT}\" style='font-size:22px;text-decoration:underline'>{$URL_REDIRECT}</a></center></p>";
    $message->setFrom($smtp_sender);
    $message->addTo($smtp_sender);
    $message->setSubject($wifidog_templates->REGISTER_SUBJECT);
    $message->setTXTBody(strip_tags($text));
    // for plain-text
    $message->setHTMLBody($text);
    $finalbody = $message->getMessage();
    if ($GLOBALS["VERBOSE"]) {
        echo $finalbody . "<hr>\n";
    }
    $webauth_msmtp = new webauth_msmtp($smtp_sender, $finalbody, $smtp_sender, $_GET["ruleid"]);
    if ($webauth_msmtp->Send()) {
        echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} " . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
        return;
    } else {
        echo "alert('Rule: {$_GET["ruleid"]} {$smtp_sender} Method 1 " . $tpl->javascript_parse_text($webauth_msmtp->logs) . "');";
    }
    $smtp = new smtp();
    if ($sock->GET_INFO("smtp_auth_user") != null) {
        $params["auth"] = true;
        $params["user"] = $sock->GET_INFO("smtp_auth_user");
        $params["pass"] = $sock->GET_INFO("smtp_auth_passwd");
    }
    $params["host"] = $sock->GET_INFO("smtp_server_name");
    $params["port"] = $sock->GET_INFO("smtp_server_port");
    if (!$smtp->connect($params)) {
        echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
        return;
    }
    if (!$smtp->send(array("from" => $smtp_sender, "recipients" => $smtp_sender, "body" => $finalbody, "headers" => null))) {
        $smtp->quit();
        echo "alert('" . $tpl->javascript_parse_text("{error_while_sending_message} {error} {$smtp->error_number} {$smtp->error_text}") . "');";
        return;
    }
    echo "alert('" . $tpl->javascript_parse_text("{$wifidog_templates->REGISTER_SUBJECT}\nTo {$smtp_sender}: {success}") . "');";
    $smtp->quit();
}
开发者ID:articatech,项目名称:artica,代码行数:61,代码来源:webauth.rules.smtp.php

示例5: main

 public function main()
 {
     $mime = new Mail_mime();
     // Add message as html or plain text
     if ($this->isHtml()) {
         $mime->setHTMLBody($this->getMessage());
     } else {
         $mime->setTXTBody($this->getMessage());
     }
     // Add recipients
     foreach ($this->getTo() as $recipient) {
         $mime->addTo($recipient);
     }
     foreach ($this->getCc() as $recipient) {
         $mime->addCc($recipient);
     }
     foreach ($this->getBcc() as $recipient) {
         $mime->addBcc($recipient);
     }
     // Add sender and subject
     $mime->setFrom($this->getFrom());
     $mime->setSubject($this->getSubject());
     // Send the damnedable thing!
     $body = $mime->get();
     $headers = $mime->headers();
     $this->log("Assembled headers: " . print_r($headers, true));
     $mail =& Mail::factory('mail');
     $status = $mail->send($this->getTo(), $headers, $body);
     // Handle the outcome of our send attempt
     if ($status === true) {
         $recipCount = count($this->getTo()) + count($this->getCc()) + count($this->getBcc());
         $this->log("Sent MIME mail to {$recipCount} recipients");
     } else {
         throw new BuildException('Failed to send MIME mail: ' . $status->getMessage());
     }
 }
开发者ID:nlmdev,项目名称:phingistrano-monkeypatch,代码行数:36,代码来源:MimeMailTask.php


注:本文中的Mail_mime::setSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。