本文整理汇总了PHP中POP3::Connect方法的典型用法代码示例。如果您正苦于以下问题:PHP POP3::Connect方法的具体用法?PHP POP3::Connect怎么用?PHP POP3::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POP3
的用法示例。
在下文中一共展示了POP3::Connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
echo "<span class=\"error\">SMTP: 'SMTP Server' field not filled in.</span><br />";
} else {
if ($_REQUEST["from"] == "") {
echo "<span class=\"error\">SMTP: 'Default E-mail Address' field not filled in.</span><br />";
} else {
if ($_REQUEST["to"] == "") {
echo "<span class=\"error\">SMTP: 'Send To' field not filled in.</span><br />";
}
}
}
}
$pop3valid = false;
if ($pop3server != "" && $_REQUEST["user"] != "" && $_REQUEST["pass"] != "") {
$pop3options = array("server" => $pop3server, "port" => $pop3port, "secure" => $pop3port == 995);
$temppop3 = new POP3();
$result = $temppop3->Connect($_REQUEST["user"], $_REQUEST["pass"], $pop3options);
if (!$result["success"]) {
echo "<span class=\"error\">Failed to connect to the POP3 server. " . htmlspecialchars($result["error"]) . (isset($result["info"]) ? " (" . htmlspecialchars($result["info"]) . ")" : "") . "</span><br />";
} else {
echo "<span class=\"success\">Successfully connected to the POP3 server.</span><br />";
$temppop3->Disconnect();
$pop3valid = true;
}
} else {
if ($pop3server == "") {
echo "<span class=\"error\">POP3: 'POP3 Server' field not filled in.</span><br />";
} else {
if ($_REQUEST["user"] == "") {
echo "<span class=\"error\">POP3: 'Username' field not filled in.</span><br />";
} else {
if ($_REQUEST["pass"] == "") {
示例2: error_reporting
error_reporting(E_ALL);
// php errors
define('DISPLAY_XPM4_ERRORS', true);
// display XPM4 errors
// path to 'POP3.php' and 'SMTP.php' files from XPM4 package
require_once '../POP3.php';
require_once '../SMTP.php';
$f = 'username@hostname.net';
// from mail address / account username
$t = 'client@destination.net';
// to mail address
$p = 'password';
// account password
// standard mail message RFC2822
$m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: test' . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . 'Text message.';
// connect to 'pop3.hostname.net' POP3 server address with authentication username '$f' and password '$p'
$p = POP3::Connect('pop3.hostname.net', $f, $p) or die(print_r($_RESULT));
// connect to 'smtp.hostname.net' SMTP server address
$c = SMTP::Connect('smtp.hostname.net') or die(print_r($_RESULT));
// send mail
$s = SMTP::Send($c, array($t), $m, $f);
// print result
if ($s) {
echo 'Sent !';
} else {
print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::Disconnect($c);
// disconnect from POP3 server
POP3::Disconnect($p);
示例3: 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;
}