1
我试图发送邮件时,我安装了梨邮件,并得到以下错误。 在没有任何答案的情况下在网上搜索了发生了什么的任何线索? 嗨,我试图发送邮件时,我安装了梨邮件,并得到以下错误。 在没有任何答案的情况下在网上搜索了发生了什么的任何线索?梨邮件,无法将发件人设置为错误
unable to set sender to [[email protected]]
代码:
<?php
// Include the Mail package
require "Mail.php";
// Identify the sender, recipient, mail subject, and body
$sender = "[email protected]";
$recipient = "[email protected]";
$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 = "[email protected]";
$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());
}
?>