私は tank_auth ライブラリで codeigniter 2 を使用しています。user_model という名前のモデルには、電子メールを送信する関数 (_send_email()) があります。
function _send_email($type, $email, &$data)
{
$this->load->library('email');
$this->config->set_item('language', 'dutch');
$this->email->set_newline("\r\n");
$this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
//$this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
$this->email->to($email);
$this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
$this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));
if($this->email->send()){
echo "sendit";
}
}
私はこのようなコントローラーからこの関数を呼び出そうとします:
public function email($value='')
{
$this->lang->load('tank_auth', 'dutch');
$this->load->model('user_model');
$data = array("site_name" => "site name");
$this->user_model->_send_email('bestelling_geplaatst', "my_email@hotmail.com",$data); // send
}
問題は、電子メールが電子メール アドレスに 2 回送信されていることです。
この問題に出くわした人は誰でも、解決策 (または問題) を探す場所を知っています
より詳しい情報:
ここのような使用ガイドの例のように、コントローラーでメソッドを作成しようとしています: https://www.codeigniter.com/user_guide/libraries/email.html
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
この方法でもメールが 2 回送信されます。