簡體   English   中英

使用codeigniter發送電子郵件

[英]sending emails using codeigniter

我正在嘗試使用以下代碼發送電子郵件$ 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'];

刪除這兩行

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

因為您嘗試在此處發送兩次“發送”電子郵件

 if($this->email->send())

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM