dongshi3061 2016-09-30 16:20
浏览 44

Phpmailer和oauth

I am trying to send emails using gmail smtp server with oauth. I have received refresh token, there everything was ok, but as I couldn't find any example for sending email with oauth, seems like I am missing something in mail sending script. My code is the following:

$phpmailer = new PHPMailerOAuth();
$phpmailer->IsSMTP();
$phpmailer->SMTPDebug  = 2;
$phpmailer->Host       = "ssl://smtp.gmail.com";
$phpmailer->SMTPAuth   = true;
$phpmailer->SMTPSecure = 'ssl';
$mail->AuthType = 'XOAUTH2';
$phpmailer->Port       = 465;

$phpmailer->oauthClientId = "***";
$phpmailer->oauthClientSecret = "***";
$phpmailer->oauthRefreshToken = "***";
$phpmailer->oauthUserEmail="***";
  • 写回答

1条回答 默认 最新

  • douping3891 2016-09-30 17:50
    关注

    Just found the solution. In case anyone needs, my problem was that I haven't included vendor/autoload.php file, which composer created:

      require_once dirname(__FILE__).'/PHPMailerAutoload.php';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料