梨邮件,无法将发件人设置为错误


Pear Mail, unable to set sender to error

我安装了Pear Mail,在尝试发送邮件时出现以下错误。在网上搜索,没有任何答案,也没有任何线索发生了什么?嗨,我安装了梨邮件,在尝试发送邮件时出现以下错误。在网上搜索,没有任何答案,也没有任何线索发生了什么?

unable to set sender to [me@gmail.com]

代码:

    <?php
    // Include the Mail package
   require "Mail.php";
   // Identify the sender, recipient, mail subject, and body
   $sender    = "me@gmail.com";
   $recipient = "jason@example.com";
   $subject   = "Thank you for your email!";
   $body      = "I'll get back to you as soon as I can!";
   // Identify the mail server, username, password, and port
   $server   = "ssl://smtp.gmail.com";
   $username = "me@gmail.com";
   $password = "supersecret";
   $port     = "465";
   // Set up the mail headers
   $headers = array(
      "From"    => $sender,
      "To"      => $recipient,
      "Subject" => $subject
   );
   // Configure the mailer mechanism
   $smtp = Mail::factory("smtp",
      array(
        "host"     => $server,
        "username" => $username,
        "password" => $password,
        "auth"     => true,
        "port"     => 465
      )
   );
   // Send the message
   $mail = $smtp->send($recipient, $headers, $body);
   if (PEAR::isError($mail)) {
      echo ($mail->getMessage());
   }
?>

这是一个很长的机会,但我想你已经建立了自己的gmail帐户。否则您将无法模拟me@gmail.com