php框架

 首页 > php框架 > CodeIgniter框架发送Email - SMTP

CodeIgniter框架发送Email - SMTP

分享到:
【字体:
导读:
          首先,先在application/config文件夹下建立一个文件,名为:email.php,内容如下: if( ! defined(BASEPATH))exit(No direct script access allowed); $config[protocol] =smtp; $config[smtp_host] =smtp地址; $config[smtp_user...

首先,先在application/config文件夹下建立一个文件,名为:email.php,内容如下:
 
if( ! defined('BASEPATH'))exit('No direct script access allowed');
  
$config['protocol'] ='smtp';
$config['smtp_host'] ='smtp地址';
$config['smtp_user'] ='smtp账户';
$config['smtp_pass'] ='smtp密码';
$config['smtp_port'] ='25';  
$config['charset'] ='utf-8';  
$config['wordwrap'] = TRUE;  
$config['mailtype'] ='html';
然后再要发送邮件的地方加入:
 
$this->load->library('email');
$this->email->from('smtp账户','Q-blog');
$this->email->to('test@qq.coom');//发送给谁
$this->email->cc('test@163.com');//抄送
$this->email->attach('images/test.jpg');//附件
$this->email->subject('test email title');//邮件标题
$this->email->message('test email content'); //邮件内容
$this->email->send();//发送
 
分享到:
CodeIgniter表单验证
CodeIgniter表单验证的使用, 在需要验证的地方加入:   $this->load->helper('form'); $this->load->library('form_validation');    //设置验证规则 /* $config = array(    array(          'field'   => 'category',   ...
CodeIgniter框架Session的使用
要想在CodeIgniter框架使用Session, 首先:打开application/config文件夹下的config.php文件,找到:   $config['encryption_key'] =''; 设置encryption_key,例如改为:   $config['encryption_key'] ='ffasfas@$#364F32423J'; 然后在要使用Sessi...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……