function sendTestmail
这个提交包含在:
父节点
0f7f1176bd
当前提交
3ef158b638
共有 1 个文件被更改,包括 43 次插入 和 0 次删除
|
|
@ -380,4 +380,47 @@ class Options extends CI_Controller {
|
|||
redirect('/options/oqrs');
|
||||
}
|
||||
|
||||
public function sendTestMail() {
|
||||
$this->load->model('user_model');
|
||||
|
||||
$id = $this->session->userdata('user_id');
|
||||
|
||||
$email = $this->user_model->get_user_email_by_id($id);
|
||||
|
||||
if($email != "") {
|
||||
|
||||
$this->load->library('email');
|
||||
|
||||
if($this->optionslib->get_option('emailProtocol') == "smtp") {
|
||||
$config = Array(
|
||||
'protocol' => $this->optionslib->get_option('emailProtocol'),
|
||||
'smtp_crypto' => $this->optionslib->get_option('smtpEncryption'),
|
||||
'smtp_host' => $this->optionslib->get_option('smtpHost'),
|
||||
'smtp_port' => $this->optionslib->get_option('smtpPort'),
|
||||
'smtp_user' => $this->optionslib->get_option('smtpUsername'),
|
||||
'smtp_pass' => $this->optionslib->get_option('smtpPassword'),
|
||||
'crlf' => "\r\n",
|
||||
'newline' => "\r\n"
|
||||
);
|
||||
|
||||
$this->email->initialize($config);
|
||||
}
|
||||
|
||||
$message = $this->load->view('email/testmail.php', NULL, TRUE);
|
||||
|
||||
$this->email->from($this->optionslib->get_option('emailAddress'), $this->optionslib->get_option('emailSenderName'));
|
||||
$this->email->to($email);
|
||||
$this->email->subject('Cloudlog Test-Mail');
|
||||
$this->email->message($message);
|
||||
|
||||
if (! $this->email->send()){
|
||||
$this->session->set_flashdata('success', 'Email settings are incorrect.');
|
||||
} else {
|
||||
$this->session->set_flashdata('message', 'Email settings seem to be correct');
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('error', 'You have no email address in your account settings!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用