我正在尝试使用以下代码发送电子邮件 $ this-> load-> library('email',$ config);
$this->email->from('leena.nasir552@gmail.com');
$this->email->to('leena.nasir@morgan.com');
$this->email->subject('my email');
$this->email->message($message);
$result = $this->email->send() ;
echo($result) ;
if($this->email->send())
{
$params = array (
'SenderId'=> $senderId,
'ReceiverId'=> $recieverId,
'Message'=> $message,
'Status' => 'Sent' // set the statues variable to Sent if it sent successfully
);
$this->UserModel->addMessage($params);
} else {
echo $this->email->print_debugger();
$params = array (
'SenderId' => $senderId,
'ReceiverId' => $recieverId,
'Message'=> $message,
'Status' => 'failed' // set the status to failed if the message sending failed
);
$this->UserModel->addMessage($params);
}
每次我尝试发送电子邮件时都会收到此错误的问题
遇到PHP错误
严重性:注意
消息:未定义的索引:主题
文件名:libraries / Email.php
行号:982
任何人都可以帮我解决这个错误吗?这是来自Email.php图书馆的第982行
$this->_subject = $this->_headers['Subject'];
答案 0 :(得分:2)
删除这两行
$result = $this->email->send() ;
echo($result) ;
因为您尝试两次发送电子邮件而在此处发送“发送”
if($this->email->send())