当前位置: 首页>>代码示例>>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;未经允许,请勿转载。