Php 如何使用Google OAuth来使用自动电子邮件发送程序而不提供密码?

Php 如何使用Google OAuth来使用自动电子邮件发送程序而不提供密码?,php,email,google-api,google-email-settings-api,Php,Email,Google Api,Google Email Settings Api,我目前正在构建一个系统,我正在使用GoogleOAuth和GoogleAutoEmailer代码 我为您提供了这段代码,以可视化我希望发生的事情 <?php include_once "mailer.php" ; $mail = new Mailer(); $email = "sample@gmail.com"; $name = "Daniel"; $subject= "testing"; $message = "Why so serious??"; $mai

我目前正在构建一个系统,我正在使用GoogleOAuth和GoogleAutoEmailer代码

我为您提供了这段代码,以可视化我希望发生的事情

<?php
  include_once "mailer.php" ;
  $mail = new Mailer();
  $email = "sample@gmail.com";
  $name = "Daniel";
  $subject=  "testing";
  $message = "Why so serious??";
  $mail->mail($email,$subject,$message);

  if(!$email){
    echo " mail not sent  " ;

  }
  else if ($email) {
    echo "mail sent! " ;
  }

为什么不使用。对于我们这些编程高手来说,谷歌的人是世俗之王,但我喜欢Zend框架,因为它很简单,并且使用PHP固有的邮件发送功能。试试看,我认为它可能符合要求。

根据OP的问题,你能给出一个不需要用户谷歌密码(例如使用应用程序密钥)的代码示例吗?允许发送到任意地址而无需验证的电子邮件系统通常被称为垃圾邮件网关。我不知道你怎么能期望通过一个经过认证的系统发送而不经过认证。。。