當前位置: 首頁>>代碼示例>>PHP>>正文


PHP POP3::popBeforeSmtp方法代碼示例

本文整理匯總了PHP中POP3::popBeforeSmtp方法的典型用法代碼示例。如果您正苦於以下問題:PHP POP3::popBeforeSmtp方法的具體用法?PHP POP3::popBeforeSmtp怎麽用?PHP POP3::popBeforeSmtp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在POP3的用法示例。


在下文中一共展示了POP3::popBeforeSmtp方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPopBeforeSmtpBad

 /**
  * Use a fake POP3 server to test POP-before-SMTP auth
  * With a known-bad login
  */
 public function testPopBeforeSmtpBad()
 {
     //Start a fake POP server on a different port
     //so we don't inadvertently connect to the previous instance
     $pid = shell_exec('nohup ./runfakepopserver.sh 1101 >/dev/null 2>/dev/null & printf "%u" $!');
     $this->pids[] = $pid;
     sleep(2);
     //Test a known-bad login
     $this->assertFalse(POP3::popBeforeSmtp('localhost', 1101, 10, 'user', 'xxx', $this->Mail->SMTPDebug), 'POP before SMTP should have failed');
     shell_exec('kill -TERM ' . escapeshellarg($pid));
     sleep(2);
 }
開發者ID:rkenterprisesgroup,項目名稱:rkenterprisesgroup.github.io,代碼行數:16,代碼來源:phpmailerTest.php

示例2: PHPMailer

<?php

/**
 * This example shows how to use POP-before-SMTP for authentication.
 */
require '../PHPMailerAutoload.php';
//Authenticate via POP3.
//After this you should be allowed to submit messages over SMTP for a while.
//Only applies if your host supports POP-before-SMTP.
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
    $mail->isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 2;
    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';
    //Set the hostname of the mail server
    $mail->Host = "mail.example.com";
    //Set the SMTP port number - likely to be 25, 465 or 587
    $mail->Port = 25;
    //Whether to use SMTP authentication
    $mail->SMTPAuth = false;
    //Set who the message is to be sent from
    $mail->setFrom('from@example.com', 'First Last');
    //Set an alternative reply-to address
開發者ID:CloudNumericalCalculation,項目名稱:cloudcalc-web,代碼行數:31,代碼來源:pop_before_smtp.php


注:本文中的POP3::popBeforeSmtp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。