通过ci框架mail邮件类发送邮件
程序员文章站
2022-05-19 18:29:53
...
通过ci框架mail邮件类发送邮件和利用利用第三方平台发送邮件 无 public function mail(){ $param = array(); $param['to'] = 'qing.chen'; $param['subject'] = '邮件测试-标题'; //$param['tmpl'] = 'email/demo'; $param['content'] = "111"; $this-MailMod
通过ci框架mail邮件类发送邮件和利用利用第三方平台发送邮件
public function mail() { $param = array(); $param['to'] = 'qing.chen'; $param['subject'] = '邮件测试-标题'; //$param['tmpl'] = 'email/demo'; $param['content'] = "111"; $this->MailModel->sendMail($param); echo 'sss'; }
class MailModel extends CI_Model { /** * 生成邮件内容 * * @param string $templ * @param array $data * @return string * @author http://blog.iwshop.com/ */ public function makeBody($tmpl, $data) { $content = $this->load->view($tmpl, $data, true); return $content; } /** * 发送邮件 * * @param array $param * @return boolean */ public function sendMail($param) { // 发件人配置 if ( empty($param['frommail'])) $param['frommail'] = 'woims'; if ( empty($param['fromname'])) $param['fromname'] = '运营平台'; $param['frommail'] = $this->_domain($param['frommail']); // CI mail 配置 $this->load->library('email'); $config = array(); $config['charset'] = "UTF-8"; // 编码 $config['wordwrap'] = TRUE; // 自动换行 $config['mailtype'] = 'html'; // 格式 (text/html) $config['protocol'] = 'SMTP'; // 邮件协议 $this->email->initialize($config); //$param['cc'] = 'barly.li,qingbin.wu'; $this->email->from($param['frommail'], $param['fromname']); if ( $param['to']) $this->email->to($this->_domain($param['to'])); if ( $param['cc']) $this->email->cc($this->_domain($param['cc'])); if ( $param['bcc']) $this->email->bcc($this->_domain($param['bcc'])); //如果存在邮件模板使用模板作为邮件内容 2015-01-08 $param['content'] = $param['tmpl'] ? $this->makeBody($param['tmpl'], $param['data']) : $param['content']; $this->email->subject($param['subject']); $this->email->message($param['content']); $this->email->send(); return true; }
推荐阅读
-
php多种形式发送邮件(mail qmail邮件系统 phpmailer类)
-
PHP mail 通过Windows的SMTP发送邮件失败的解决方案
-
解决ci框架php发送邮件附件中文乱码问题
-
PHP mail 通过Windows的SMTP发送邮件失败的解决方案
-
php多种形式发送邮件(mail qmail邮件系统 phpmailer类)
-
CI框架简单邮件发送类实例,ci框架邮件发送
-
php多种形式发送邮件(mail qmail邮件系统 phpmailer类)
-
Zend Framework框架之Zend_Mail实现发送Email邮件验证功能及解决标题乱码的方法_PHP
-
Zend Framework框架之Zend_Mail实现发送Email邮件验证功能及解决标题乱码的方法_PHP
-
PHP mail 通过Windows的SMTP发送邮件失败的解决方案_PHP教程