好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

ci框架邮件发送类库

ci框架绝对是php初学中想要的东西,它能极大的缩短你的代码量!

下面看看我的发送邮件的简单演示:



 
	 
		 function   email  ()  
	 
		 {  
	 
		 $this  ->  load  ->  library  (  'email'  );  
	 
		 $config  [  'protocol'  ]     =     'smtp'  ;  
	 
		 $config  [  'smtp_host'  ]     =     'smtp.163.com'  ;  
	 
		 $config  [  'smtp_user'  ]     =     'phpddt1990@163.com'  ;  //这里写上你的163邮箱账户  
	 
		 $config  [  'smtp_pass'  ]     =     'phpddt;'  ;  //这里写上你的163邮箱密码  
	 
		 $config  [  'mailtype'  ]     =     'html'  ;  
	 
		 $config  [  'validate'  ]     =     true  ;  
	 
		 $config  [  'priority'  ]     =     1  ;  
	 
		 $config  [  'crlf'  ]     =     "\r\n"  ;  
	 
		 $config  [  'smtp_port'  ]     =     25  ;  
	 
		 $config  [  'charset'  ]     =     'utf-8'  ;  
	 
		 $config  [  'wordwrap'  ]     =   TRUE  ;  
	 
		  
	 
		 $this  ->  email  ->  initialize  (  $config  );  
	 
		  
	 
		  
	 
		 $this  ->  email  ->  from  (  'phpddt1990@163.com'  ,     '合肥学院青年志愿者联合会'  );  //发件人  
	 
		 $this  ->  email  ->  to  (  '987044391@qq.com'  );  
	 
		  
	 
		 $this  ->  email  ->  message  (  '哈哈,测试邮件发送'  );  
	 
		 $this  ->  email  ->  send  ();  
	 
		 echo $this  ->  email  ->  print_debugger  ();  
	 
		    
	 
		 }  
 

 

如果您不想使用使用上述方法设定参数,您可以把它们放入一个配置文件。创建一个新文件称为 email.php ,添加 $config 数组在该文件中。然后将该文件保存为 config/email.php  它将自动的被使用。如果您保存了一个参数配置文件,就不需要使用 $this->email->initialize() 函数来初始化参数了

查看更多关于ci框架邮件发送类库的详细内容...

  阅读:62次