我有一个可以传递参数以轻松发送电子邮件的功能。
就是这个 :
function __construct() {
$this -> CI = get_instance();
$this -> CI -> load -> library('email');
}
public function send_one_email($single_email, $single_subject, $single_body, $single_attach) {
$this -> CI -> email -> clear();
$this -> CI -> email -> to($single_email);
$this -> CI -> email -> from('**************');
$this -> CI -> email -> subject($single_subject);
$this -> CI -> email -> message($single_body);
if ($single_attach) {
$this -> CI -> email -> attachment($single_attach);
}
if ($this -> CI -> email -> send()) …Run Code Online (Sandbox Code Playgroud)