PHPMailer发送邮件”SMTP 错误:无法连接到 SMTP 主机“

 更新时间:2016年11月25日 15:41  点击:1805
PHPMailer是一个邮件发送插件有很多朋友使用它来发邮件,但也有不少朋友在使用期PHPMailer发邮件时就碰到”SMTP 错误:无法连接到 SMTP 主机“错误了,出现这种问题我们从几个点来分享,一个是邮箱配置有问题,另一个是我们的php.ini环境中有些函数没开启导致的,下面我来给各位详细介绍一下问题的排除技巧。


原因分析

出现这个问题说明无法解析 SMTP 主机 <主机 id> 的名称。

解决办法,这个要看邮箱支付不支持pop3发送与接收邮件这个可以邮件官方看看,如QQ邮件

phpmailer error SMTP Error: Could not connect to SMTP host Could not instantiate mail function

弄了半天,原来是不同邮件系统要求的smtp请求不同,但是都允许大写,有些不支持小写,比如网易,腾讯的邮箱。
原来的设置

$mail->SMTPAuth = true;
$mail->Mailer   = "smtp";
$mail->Host = "smtp.qq.com";
$mail->Port = 25; //设置邮件服务器的端口,默认为25
$mail->Username = "8515888@qq.com";
$mail->Password = "xxxxxxxxxx";

把smtp改成大写就可以了

$mail->Mailer   = "SMTP";

分析问题2,

还有大家就是使用了空间而不是服务器这样有可能像fsockopen、pfsockopen都禁用了,因为phpmailer需要使用fsockopen、pfsockopen才可以发邮件所以就会有问题了。

解决办法

找到class.smtp.php文件,大约在文件的128行吧,有这样一段代码:


// connect to the smtp server
    $this->smtp_conn = @fsockopen($host,    // the host of the server
                                 $port,    // the port to use
                                 $errno,   // error number if any
                                 $errstr,  // error message if any
                                 $tval);   // give up after ? secs
方法1:将fsockopen函数替换成pfsockopen函数

因为pfsockopen的参数与fsockopen基本一致,所以只需要将@fsockopen替换成@pfsockopen就可以了。

方法2:使用stream_socket_client函数

一般fsockopen()被禁,pfsockopen也有可能被禁,所以这里介绍另一个函数stream_socket_client()。

stream_socket_client的参数与fsockopen有所不同,所以代码要修改为:

$this->smtp_conn = stream_socket_client("tcp://".$host.":".$port, $errno,  $errstr,  $tval);

这样就可以了。

下面来给大家介绍一个php版淘宝网查询商品接口代码的例子,下面要改成你的信息的在代码后面都有说明了,同时sdk包我们也要官方下载哦。

其实我也没做什么只是把标准事例改了下。

请下载SDK包解压后与该文件放在同一目录下。

 代码如下 复制代码

<?php

header("Content-type: text/html; charset=utf-8");
include "TopSdk.php";
//将下载SDK解压后top里的TopClient.php第8行$gatewayUrl的值改为沙箱地址:http://gw.api.tbsandbox.com/router/rest,
//正式环境时需要将该地址设置为:http://gw.api.taobao.com/router/rest
 
//实例化TopClient类
$c = new TopClient;
$c->appkey = "xxxxxx"; //换成你的
$c->secretKey = "xxxxxxxx"; //换成你的
$sessionkey= "";   //如沙箱测试帐号sandbox_c_1授权后得到的sessionkey
//实例化具体API对应的Request类
$req = new ItemGetRequest();
$req->setFields("num_iid,title");
$req->setNumIid(23899912039);
//$req->setNick("sandbox_c_1");
 
//执行API请求并打印结果
$resp = $c->execute($req,"");
echo "result:";
print_r($resp);
?>

php多进程这个东西先是在java中有不过现在高版本的php也支持多进程这个功能,但经过测试性能不如java了希望后期有所提高了,下面我们一起来看看我整理了几个关于php多进程例子,希望能帮助你理解多线程了哦。

php多进程的实现依赖于pcntl扩展,编译PHP的时候,可以加上’–enable-pcntl’或者也可以单独编译。

有三点需要注意:

1.子进程不在执行fork之前的代码,只是把父进程的内存状况复制一份新的,所以,关于子进程的个性化设置需要单独设置。
2.输出重定向,程序中使用echo,或造成命令行的混乱,影响分辨。可以用ob_start重定向到log文件,当然,你直接使用log是更好的办法。此实例中log文件,按照进程pid分组。
3.父进程没有代码执行,将可能提前退出,子进程可能成为孤儿进程。

demo接受:
用10个子进程来处理输出任务,任务总量是1000,然后,按照任务数平均分到十个子进程当中去。

 代码如下 复制代码

<?php
                                                                                                //输出重定向到log文件                  
function echo_to_log($content){
    global $current_pid;
    $logfile =  __FILE__ . $current_pid .  '.log';
    $fp = fopen($logfile, 'a+');
    fwrite($fp, $content);
    fclose($fp);
}
                                                                                 
ob_start('echo_to_log');
//获取当前进程pid
$current_pid = getmypid();
$fork_nums = 10;
$total = 1000;
                                                                                 
for($i = 0; $i < $fork_nums; $i++){
    $pid = pcntl_fork();
    //等于0时,是子进程
    if($pid == 0){
        $current_pid = $pid;
        do_task($i);
     //大于0时,是父进程,并且pid是产生的子进程的PID
    } else if($pid > 0) {
    }
}
                                                                                 
//任务函数
function do_task($task_num){
    global $total;
    $start = $total / 10 * $task_num;
    $end = $total / 10 * ($task_num + 1);
    for(;$start<$end;$start++){
        echo $task_num . " " . $start . "\n";
    }
    //子进程执行完任务以后终止,当然你可以返回主进程的代码部分做相关操作。
    exit();
}

多进程控制的框架代码,留着备查

 代码如下 复制代码

declare(ticks=1);
function sigHandler($signal)
{
    echo "a child exited\n";
}
pcntl_signal(SIGCHLD, sigHandler, false);
echo "this is " . posix_getpid() . PHP_EOL;
for($i=0; $i<3; $i++)
{
    $pid = pcntl_fork();
    if($pid == -1)
    {  
        echo 'fork failed ' . PHP_EOL;
    }  
    else if($pid)
    {  
    }  
    else
    {  
        $pid = posix_getpid();
        echo 'child ' . $pid . ' ' . time() . PHP_EOL;
        sleep(rand(2,5));
        echo 'child ' . $pid . ' done ' . time() . PHP_EOL;
        exit(0);
    }  
}
do
{
    $pid = pcntl_wait($status);
    echo 'child quit ' . $pid . PHP_EOL;
}while($pid > 0);
echo 'parent done' . PHP_EOL;


例子
给出一段PHP多线程、与For循环,抓取百度搜索页面的PHP代码示例:

 代码如下 复制代码

<?php
  class test_thread_run extends Thread
  {
      public $url;
      public $data;

      public function __construct($url)
      {
          $this->url = $url;
      }

      public function run()
      {
          if(($url = $this->url))
          {
              $this->data = model_http_curl_get($url);
          }
      }
  }

  function model_thread_result_get($urls_array)
  {
      foreach ($urls_array as $key => $value)
      {
          $thread_array[$key] = new test_thread_run($value["url"]);
          $thread_array[$key]->start();
      }

      foreach ($thread_array as $thread_array_key => $thread_array_value)
      {
          while($thread_array[$thread_array_key]->isRunning())
          {
              usleep(10);
          }
          if($thread_array[$thread_array_key]->join())
          {
              $variable_data[$thread_array_key] = $thread_array[$thread_array_key]->data;
          }
      }
      return $variable_data;
  }

  function model_http_curl_get($url,$userAgent="")
  {
      $userAgent = $userAgent ? $userAgent : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)';
      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, $url);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($curl, CURLOPT_TIMEOUT, 5);
      curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
      $result = curl_exec($curl);
      curl_close($curl);
      return $result;
  }

  for ($i=0; $i < 100; $i++)
  {
      $urls_array[] = array("name" => "baidu", "url" => "http://www.baidu.com/s?wd=".mt_rand(10000,20000));
  }

  $t = microtime(true);
  $result = model_thread_result_get($urls_array);
  $e = microtime(true);
  echo "多线程:".($e-$t)."\n";

  $t = microtime(true);
  foreach ($urls_array as $key => $value)
  {
      $result_new[$key] = model_http_curl_get($value["url"]);
  }
  $e = microtime(true);
  echo "For循环:".($e-$t)."\n";
?>


PHP多线程类)

 

 代码如下 复制代码
/**
 * @title:  PHP多线程类(Thread)
 * @version: 1.0
 * @author:   < web@ >
 * @published: 2010-11-2
 *
 * PHP多线程应用示例:
 *  require_once 'thread.class.php';
 *  $thread = new thread();
 *  $thread->addthread('action_log','a');
 *  $thread->addthread('action_log','b');
 *  $thread->addthread('action_log','c');
 *  $thread->runthread();
 * 
 *  function action_log($info) {
 *   $log = 'log/' . microtime() . '.log';
 *   $txt = $info . "rnrn" . 'Set in ' . Date('h:i:s', time()) . (double)microtime() . "rn";
 *   $fp = fopen($log, 'w');
 *   fwrite($fp, $txt);
 *   fclose($fp);
 *  }
 */
class thread {
 
    var $hooks = array();
    var $args = array();
   
    function thread() {
    }
   
    function addthread($func)
    {
     $args = array_slice(func_get_args(), 1);
     $this->hooks[] = $func;
  $this->args[] = $args;
  return true;
    }
   
    function runthread()
    {
     if(isset($_GET['flag']))
     {
      $flag = intval($_GET['flag']);
     }
     if($flag || $flag === 0)
  {
   call_user_func_array($this->hooks[$flag], $this->args[$flag]);
  }
     else
     {
         for($i = 0, $size = count($this->hooks); $i < $size; $i++)
         {
          $fp=fsockopen($_SERVER['HTTP_HOST'],$_SERVER['SERVER_PORT']);
          if($fp)
          {
           $out = "GET {$_SERVER['PHP_SELF']}?flag=$i HTTP/1.1rn";
           $out .= "Host: {$_SERVER['HTTP_HOST']}rn";
           $out .= "Connection: Closernrn";
                 fputs($fp,$out);
                 fclose($fp);
          }
         }
     }
    }
}

使用方法:

 代码如下 复制代码

$thread = new thread();
$thread->addthread('func1','info1');
$thread->addthread('func2','info2');
$thread->addthread('func3','info3');
$thread->runthread();

说明:

addthread是添加线程函数,第一个参数是函数名,之后的参数(可选)为传递给指定函数的参数。

runthread是执行线程的函数。

在linux系统中需要配置安装一下pthreads

1、扩展的编译安装(Linux),www.111cn.net 编辑参数 --enable-maintainer-zts 是必选项:

 代码如下 复制代码

cd /Data/tgz/php-5.5.1
./configure --prefix=/Data/apps/php --with-config-file-path=/Data/apps/php/etc --with-mysql=/Data/apps/mysql --with-mysqli=/Data/apps/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/Data/apps/libs --with-jpeg-dir=/Data/apps/libs --with-png-dir=/Data/apps/libs --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/Data/apps/libs --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts
make clean
make
make install       

unzip pthreads-master.zip
cd pthreads-master
/Data/apps/php/bin/phpize
./configure --with-php-config=/Data/apps/php/bin/php-config
make
make install


vi /Data/apps/php/etc/php.ini

添加:

 代码如下 复制代码
extension = "pthreads.so"

PHP扩展下载:https://github.com/krakjoe/pthreads
PHP手册文档:http://php.net/manual/zh/book.pthreads.php

我们使用phpmailer登录邮件发邮件也是使用了curl原理来实现模仿用户发邮件了,今天看了两个利用CURL函数登入163邮箱并获取自己的通讯录的例子,希望对各位有帮助。

学习了一些CURL的基础知识并做了这个示例,关于CURL的知识可以从php的官网上查看,点击查看。
示例代码调试方式:把$userName和$password换成自己163邮箱的用户名和密码即可。
注意:用户名和密码一定要正确,否则报错,没有做容错处理。

示例代码如下:

 代码如下 复制代码

<?php
//==================账号信息==================
//用户名
$userName = 'xxxxxxxx';
//密码
$password = 'xxxxxxxx';
//邮箱
$email = $userName . '@163.com';
//==================登录==================
//登录地址(登录地址并不是form表单设置的地址,通过js修改了form的action属性,需要查看登录页面源码才能发现)
$loginUrl = "https://ssl.mail.163.com/entry/coremail/fcg/ntesdoor2?df=mail163_letter&from=web&funcid=loginone&iframe=1&language=-1&passtype=1&product=mail163&net=n&style=-1&race=-2_56_-2_hz&uid={$email}";
//登录时发送的post数据(查看form表单,注意有隐藏域)
$postArray = array(
    "url2" => "http://mail.163.com/errorpage/error163.htm",
    "savelogin" => 0,  "username" => trim($userName), "password" => $password,
);
$postString = '';
foreach($postArray as $key => $value){
    $postString .= "{$key}={$value}&";
}
$postString = trim($postString, '&');
//初始化CURL对象
$curl = curl_init();
//设置请求地址
curl_setopt($curl, CURLOPT_URL, $loginUrl);
//禁用后CURL将终止从服务端进行验证
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
//启用时将获取的信息以文件流的形式返回,而不是直接输出
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
//启用时会将头文件的信息作为数据流输出
curl_setopt($curl, CURLOPT_HEADER, TRUE);
//设置POST参数
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
//执行给定的CURL会话
//成功时返回 TRUE,失败时返回 FALSE
//然而,如果 CURLOPT_RETURNTRANSFER选项被设置,函数执行成功时会返回执行的结果,失败时返回 FALSE
$html = curl_exec($curl);
//把获取到的数据写入文件中以便查看
//file_put_contents('temp1.txt', $html);
//分割头文件和内容
list($head, $content) = explode("\r\n\r\n", $html, 2);
//把获取到的数据写入文件中以便查看
//file_put_contents('temp2.txt', $head);
//file_put_contents('temp3.txt', $content);
$head = explode("\r\n", $head);
//获取cookie信息
$cookieString = '';
foreach ($head as $value){
    if(stripos($value, "Set-Cookie: ") !== false){
        $cookieString .= str_replace("Set-Cookie: ", "", $value);
    }
}
//从content里分析出sid值(读取通讯录信息的参数)
$startString = 'top.location.href = "';
$endString = '";</script>';
$start = strpos($content, $startString);
$end = strpos($content, $endString);
$tempUrl = substr($content, $start + strlen($startString), $end - $start - strlen($startString));
$tempUrlVals = parse_url($tempUrl);
parse_str($tempUrlVals['query'], $queryVals);
$sid = $queryVals['sid'];
//==================读取邮箱==================
//读取邮箱地址
$readUrl = "http://twebmail.mail.163.com/contacts/call.do?uid={$email}&sid={$sid}&from=webmail&cmd=newapi.getContacts&vcardver=3.0&ctype=all&attachinfos=yellowpage";
//设置请求地址
curl_setopt($curl, CURLOPT_URL, $readUrl);
//设置POST参数
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'order=[{"field":"N","desc":"false"}]');
//注意这里要设置从登录操作中获取的cookie
curl_setopt($curl, CURLOPT_COOKIE, $cookieString);
//禁用头文件输出
curl_setopt($curl, CURLOPT_HEADER, FALSE);
//执行给定的CURL会话
//成功时返回 TRUE,失败时返回 FALSE
//然而,如果 CURLOPT_RETURNTRANSFER选项被设置,函数执行成功时会返回执行的结果,失败时返回 FALSE
$content = curl_exec($curl);
//把获取到的数据写入文件中以便查看
//file_put_contents('temp4.txt', $content);
//关闭一个CURL会话,并释放资源
curl_close($curl);
echo '<pre>';
print_r(json_decode($content, true));
echo '</pre>';

例子二,这个更高级一些可以输入信息

 代码如下 复制代码

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>登陆163邮箱</title>
</head>
<body>
<form id="login" action="mail.php" method="POST">
<label for="username">用户名:</label><input id="username" name="username" type="text" />
<label for="password">密码:</label><input id="password" name="password" type="password" />
<input type="submit" value="取得通讯录列表" />
</form>
</body>
</html>

mail.php

 代码如下 复制代码

<?php
    define("COOKIEJAR",ini_get( "upload_tmp_dir" ).DIRECTORY_SEPARATOR."cookie.txt");
   
    if( !isset($_POST['username']) || !isset($_POST['username']) ){
        echo 'ERROR QUEST';
        exit();
    }
   
    $username = $_POST['username'];
    $pos = strrpos($username,'@');
    if($pos === false){
        $username .= "@163.com";
    }
    $password = $_POST['password'];
   
    //登陆163邮箱,获得登陆后的cookie
    $options = array(
      CURLOPT_URL => "https://reg.163.com/logins.jsp",
      CURLOPT_SSL_VERIFYPEER => false,
      CURLOPT_POST => 1,
      CURLOPT_POSTFIELDS => "username=".$username."&password=".$password,
      CURLOPT_COOKIEJAR => COOKIEJAR,
    );
    curl_quest($options);
   
    //利用上一步获得的cookie进一步取得cookie
    $options2 = array(
      CURLOPT_URL => "http://fm163.163.com/coremail/fcg/ntesdoor2?verifycookie=1&lightweight=1",
      CURLOPT_COOKIEFILE => COOKIEJAR,
      CURLOPT_COOKIEJAR => COOKIEJAR,
    );
    curl_quest($options2);
   
    //分析cookie文件,取得coremail.
    $cookiefile = file_get_contents(COOKIEJAR);
    preg_match('|Coremail.*?%(\S*)|',$cookiefile,$sid);
   
    //发送获得通讯录xml请求.
    $postStr3 = '<?xml version="1.0"?><object><array name="items"><object><string name="func">pab:searchContacts</string
><object name="var"><array name="order"><object><string name="field">FN</string><boolean name="ignoreCase"
>true</boolean></object></array></object></object><object><string name="func">user:getSignatures</string
></object><object><string name="func">pab:getAllGroups</string></object></array></object>';
    $options3 = array(
       CURLOPT_URL => 'http://eg1a120.mail.163.com/a/s?sid='.$sid[1].'&func=global:sequential',
       CURLOPT_HTTPHEADER => array('Content-Type: application/xml'),
      CURLOPT_POST => 1,
      CURLOPT_COOKIEFILE => COOKIEJAR,
      CURLOPT_POSTFIELDS => $postStr3,
      CURLOPT_REFERER => 'http://eg1a120.mail.163.com/a/f/js3/0811050934/index_v12.htm',
    );
    $mailsxml = curl_quest($options3,true);
   
    //输出获得的通讯录xml
    header("Content-Type: application/xml");
    echo $mailsxml;
   
    function curl_quest($ops,$return = false){
        $ch = curl_init();
       curl_setopt_array($ch,$ops);
        ob_start( );
        curl_exec($ch);
        if($return){
            $content=ob_get_contents();
        }
        curl_close($ch);
        ob_end_clean();
        if($return){
            return $content;
        }
    }

?>

最近某个PHP项目用到了限制登录时间的功能,比如用户登录系统60分钟后如果没有操作就自动退出,我搜索了网络收集了有以下方法可供参考。

第一种方法即设置php.ini配置文件,设置session.gc_maxlifetime和session.cookie_lifetime节点属性值,当然也可以使用ini_set函数改变当前上下文环境的属性值:

 代码如下 复制代码
ini_set('session.gc_maxlifetime', "3600"); // 秒
ini_set("session.cookie_lifetime","3600"); // 秒

第二种方法即设置Session时间戳,比如下面的办法。


在登录成功时设置时间戳为当前时间推后1小时,$_SESSION['expiretime'] = time() + 3600;。在检查用户登录情况使用如下代码:

 代码如下 复制代码

if(isset($_SESSION['expiretime'])) {
    if($_SESSION['expiretime'] < time()) {
        unset($_SESSION['expiretime']);
        header('Location: logout.php?TIMEOUT'); // 登出
        exit(0);
    } else {
        $_SESSION['expiretime'] = time() + 3600; // 刷新时间戳
    }
}

经验,其实session超时时间php默认就有一会时间了,当然我们可以按上面的方法来设置一下了,这种做法我觉得使用cookies会更方便哦。

[!--infotagslink--]

相关文章

  • c#使用netmail方式发送邮件示例

    这篇文章主要介绍了c#使用netmail方式发送邮件的示例,大家参考使用吧...2020-06-25
  • PHPMailer在SAE上无法发送邮件的解决方法

    PHPMailer在SAE上无法发送邮件怎么回事呢,我们以前在php5.2.7版本中使用了PHPMailer是可以发,但移到sae中发现无法发邮件了,那么此问题如何解决 在SAE上直接用5.2.7...2016-11-25
  • 整理几个android后台发送邮件的方法

    本文我们整理了三个android后台发送邮件的方法及示例,第一个是不借助Intent在android后台发送Email,第二个是用在收集应用的异常信息,第三个是分享一个android后台发送邮...2016-09-20
  • 网上找到的两个PHP发送邮件的例子,很不错,贴出来给初学者参考吧(不知道是否有兄弟曾贴过),呵呵(2

    Advanced Example Here we will show the full capabilities of the PHP mail function. PHP Code: <?php echo "<html><body>"; $recipient = "Kris Arndt <karn@nu...2016-11-25
  • Perl中使用MIME::Lite发送邮件实例

    这篇文章主要介绍了Perl中使用MIME::Lite发送邮件实例,本文介绍了使用sendmail方式发送、发送HTML格式邮件、smtp方式发送邮件等内容,需要的朋友可以参考下...2020-06-29
  • PHP利用Jmail组件实现发送邮件

    学过asp的朋友可能知道jmail组件是使用在asp中一个常用的邮箱发送功能,在php中如果想调用jmail功能我们需要使用com组件来操作。 我们先来介绍格式 代码如...2016-11-25
  • phpMailer 发送邮件

    //原创:www.111cn.net 注明:转载说明来处www.111cn.net // 昨天听一网友说用php 里面的mail发邮件发不出去,我想一般都是发不了的,现在大多数据邮件提供商都不准那样了...2016-11-25
  • php中利用curl smtp发送邮件实例

    本文章来介绍人一下关于与我们不同的发送邮件的方法我们来利用php curl stmp来实现邮件的发送程序。 $ telnet 邮箱SMTP服务地址 25 Trying 邮箱服务IP地址......2016-11-25
  • C#编程实现发送邮件的方法(可添加附件)

    这篇文章主要介绍了C#编程实现发送邮件的方法,具备添加附件的功能,涉及C#文件传输及邮件发送的相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
  • php定时发送邮件

    <?php // 请求 PHPmailer类 文件 require_once("class.phpmailer.php"); //发送Email函数 function smtp_mail ( $sendto_email, $subject, $body, $extra_hd...2016-11-25
  • 解决PHPMailer错误SMTP Error: Could not connect to SMTP host的办法

    PHPMailer发邮件时提示SMTP Error: Could not connect to SMTP host错误是smtp服务器的问题我们一起来看看关于SMTP Error: Could not connect to SMTP host问题的解...2016-11-25
  • C# Email发送邮件 对方打开邮件可获得提醒

    这篇文章主要为大家详细介绍了C# Email发送邮件功能,对方打开通知你,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2020-06-25
  • phpmailer发送邮件 SMTP Error: Could not authenticate 错误

    今天在使用phpmailer发送邮件时居然提示SMTP Error: Could not authenticate,这个感觉是smtp设置的问题,下面我在网上找到了几种解决办法。 今天在使用phpmailer发...2016-11-25
  • phpmailer 发送邮件实例代码

    header("Content-type:text/html;charset=utf-8"); include('phpmailer/class.phpmailer.php'); include('phpmailer/class.smtp.php'); $mail = new PHPMailer();...2016-11-25
  • phpmailer邮件发送实例(163邮箱 126邮箱 yahoo邮箱)

    phpmailer是一个非常优秀的php邮箱发送插件了,他可以几乎实现任何邮箱登录发送,下面我介绍163邮箱 126邮箱 yahoo邮箱的发送方法。 准备工作: 我们必须注册一个邮...2016-11-25
  • 利用phpmailer 发送邮件代码[发送html内容]

    我们利用 phpmailer功能实现 邮件发送功能哦,这里还利用了模板呢,就是读取指定文件内容再发送给朋友。 <?php @session_start(); include(dirname(__FILE__).'....2016-11-25
  • c#利用webmail邮件系统发送邮件示例分享

    在C#中发送邮件的方式有2种,一种是使用webmail方式进行发送,另外一种就是采用netmail发送的方式,这篇文章介绍了c#使用webmail方式发送邮件示例,大家参考使用吧...2020-06-25
  • Spring+quartz实现定时发送邮件功能实例

    本文介绍了Spring+quartz实现定时发送邮件功能实例,非常实用,有兴趣的同学快来看看吧 在ApplicationContext.xml的内容如下: 代码如下复制代码 <beans xmlns="...2017-07-06
  • 智能手机无法连接电脑问题解决办法

    导致手机不能连接电脑的问题有N种,本文章就来给各位朋友详细的总结与分析各种常见引起手机不能连接电脑的解决办法,有需要了解的朋友可参考。 一,手机数据线连接电脑...2016-09-20
  • Yii2使用swiftmailer发送邮件的方法

    这篇文章主要介绍了Yii2使用swiftmailer发送邮件的方法,结合实例形式分析了Yii2使用swiftmailer进行邮件发送的设置与代码实现技巧,需要的朋友可以参考下...2016-05-05