0

我正在尝试使用以下代码发送电子邮件 $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 错误

严重性:通知

消息:未定义索引:主题

文件名:库/Email.php

行号:982

谁能帮我解决这个错误?假设这是来自 Email.php 库的第 982 行

$this->_subject = $this->_headers['Subject'];
4

1 回答 1

2

删除这两行

 $result = $this->email->send() ;
 echo($result) ;

因为您正尝试在此处再次“发送”两次发送电子邮件

 if($this->email->send())
于 2012-07-21T13:48:06.210 回答