我正在尝试将Gmail帐户中的邮件发送到其他任何电子邮件 但是当我尝试此页面无法正常工作时,错误不断显示
我删除了代码的邮件部分,页面运行正常
我的代码:
$from = '<somthing@gmail.com>';
$to = '<anotherthing@gmail.com>';
$subject = 'Hi!';
$body = "How you doooin";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'something@gmail.com',
'password' => 'myfrompassword'
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<p>Message successfully sent!</p>');
}
这出现在我的错误日志中
[05-Nov-2019 13:19:20 UTC] PHP Warning: ob_start(): function 'callback' not found or invalid function name in /home/arabiancom9/public_html/qrcode/genrator.php on line 26
[05-Nov-2019 13:19:20 UTC] PHP Notice: ob_start(): failed to create buffer in /home/arabiancom9/public_html/qrcode/genrator.php on line 26
[05-Nov-2019 13:19:20 UTC] PHP Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in /home/arabiancom9/public_html/qrcode/Mail/smtp.php on line 365
[05-Nov-2019 13:19:20 UTC] PHP Warning: include_once(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/opt/alt/php71/usr/share/pear') in /home/arabiancom9/public_html/qrcode/Mail/smtp.php on line 365
[05-Nov-2019 13:19:20 UTC] PHP Fatal error: Uncaught Error: Class 'Net_SMTP' not found in /home/arabiancom9/public_html/qrcode/Mail/smtp.php:366
Stack trace:
#0 /home/arabiancom9/public_html/qrcode/Mail/smtp.php(271): Mail_smtp->getSMTPObject()
#1 /home/arabiancom9/public_html/qrcode/Mail/smtp.php(258): Mail_smtp->send_or_fail('<ahmedbadreldin...', Array, 'How you doooin')
#2 /home/arabiancom9/public_html/qrcode/genrator.php(103): Mail_smtp->send('<ahmedbadreldin...', Array, 'How you doooin')
#3 {main}
thrown in /home/arabiancom9/public_html/qrcode/Mail/smtp.php on line 366