【问题标题】:Pear Mail, unable to set sender to errorPear Mail,无法将发件人设置为错误
【发布时间】:2013-02-01 05:07:54
【问题描述】:

我安装了 Pear Mail,并在尝试发送邮件时收到以下错误。 网上搜了下,没有答案,不知道是怎么回事? 嗨,我安装了 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());
   }

?>

【问题讨论】:

    标签: php email gmail pear


    【解决方案1】:

    这是一个长镜头,但我猜你已经设置了自己的 gmail 帐户。 否则你将无法冒充 me@gmail.com

    【讨论】:

      猜你喜欢
      • 2012-10-30
      • 1970-01-01
      • 2011-08-16
      • 2012-05-14
      • 2013-07-27
      • 2012-03-09
      • 1970-01-01
      • 2017-10-26
      • 2011-05-11
      相关资源
      最近更新 更多