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


PHP SMTP::GetUserAgent方法代码示例

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


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

示例1: trim

            if (count($pop3server) == 2) {
                $pop3port = $pop3server[1];
                $pop3server = $pop3server[0];
            } else {
                $pop3server = trim($_REQUEST["pop3server"]);
                $pop3port = 110;
            }
            $message = <<<EOF
<html><body>Hello,<br>
<br>
This is the Single Sign-On (SSO) Server installer test e-mail.<br>
<br>
Thank you for using SSO Server.
</body></html>
EOF;
            $headers = SMTP::GetUserAgent("Thunderbird");
            $smtpsent = false;
            if ($smtpserver != "" && $_REQUEST["from"] != "" && $_REQUEST["to"] != "") {
                $smtpoptions = array("headers" => $headers, "textmessage" => strip_tags($message), "htmlmessage" => $message, "server" => $smtpserver, "port" => $smtpport, "secure" => $smtpport == 465, "username" => $_REQUEST["user"], "password" => $_REQUEST["pass"]);
                $result = SMTP::SendEmail($_REQUEST["from"], $_REQUEST["to"], "[SSO Server] Installer Test Message", $smtpoptions);
                if (!$result["success"]) {
                    echo "<span class=\"error\">Failed to connect to the SMTP server.  " . htmlspecialchars($result["error"]) . (isset($result["info"]) ? " (" . htmlspecialchars($result["info"]) . ")" : "") . "</span><br />";
                } else {
                    echo "<span class=\"success\">Successfully connected to the SMTP server and sent the test message.</span><br />";
                    $smtpsent = true;
                }
            } else {
                if ($smtpserver == "") {
                    echo "<span class=\"error\">SMTP:  'SMTP Server' field not filled in.</span><br />";
                } else {
                    if ($_REQUEST["from"] == "") {
开发者ID:marks2016,项目名称:sso,代码行数:31,代码来源:install.php

示例2: SSO_SendEmail

function SSO_SendEmail($fromaddr, $toaddr, $subject, $htmlmsg, $textmsg)
{
    if (!class_exists("SMTP")) {
        define("CS_TRANSLATE_FUNC", "BB_Translate");
        require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/smtp.php";
    }
    $headers = SMTP::GetUserAgent("Thunderbird");
    $smtpoptions = array("headers" => $headers, "htmlmessage" => $htmlmsg, "textmessage" => $textmsg, "server" => SSO_SMTP_SERVER, "port" => SSO_SMTP_PORT, "secure" => SSO_SMTP_PORT == 465, "username" => SSO_SMTPPOP3_USER, "password" => SSO_SMTPPOP3_PASS);
    $result = SMTP::SendEmail($fromaddr, $toaddr, $subject, $smtpoptions);
    if (!$result["success"] && SSO_POP3_SERVER != "") {
        // Try POP-before-SMTP.
        require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/pop3.php";
        $pop3options = array("server" => SSO_POP3_SERVER, "port" => SSO_POP3_PORT, "secure" => SSO_POP3_PORT == 995);
        $temppop3 = new POP3();
        $result = $temppop3->Connect(SSO_SMTPPOP3_USER, SSO_SMTPPOP3_PASS, $pop3options);
        if ($result["success"]) {
            $temppop3->Disconnect();
            $result = SMTP::SendEmail($fromaddr, $toaddr, $subject, $smtpoptions);
        }
    }
    return $result;
}
开发者ID:marks2016,项目名称:sso,代码行数:22,代码来源:sso_functions.php


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