Home > Backend Development > PHP Tutorial > CodeIgniter Send Email (smtp)_PHP Tutorial

CodeIgniter Send Email (smtp)_PHP Tutorial

WBOY
Release: 2016-07-14 10:06:41
Original
868 people have browsed it

$this->load->library('email');


$config['protocol'] = 'smtp';
//Send to QQ users. To display Chinese, use 'iso-8859-1'
$config['charset'] = 'iso-8859-1';
//Send to user 163. To display Chinese, use 'gb2312'
//$config['charset'] = 'gb2312';
$config['mailpath'] = 'news/index';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = 'example0624@163.com';
$config['smtp_pass'] = 'password';

$this->email->initialize($config);

$this->email->from('example0624@163.com', 'example');
$this->email->to('tosombody@qq.com');
//Set CC www.2cto.com
//$this->email->cc();
//Set up secret delivery
//$this->email->bcc();
$this->email->subject("The test of CodeIgniter's sending mail");
$this->email->message('Hello, this is my test program. Please do not reply to the email sent successfully through CodeIgniter.');
//The path needs to use an absolute path
$this->email->attach('D:/QCallServer/htdocs/CI/public/images/google.jpg');
if ($this->email->send()) {

echo 'success...';
} else {
echo 'failed...';
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477911.htmlTechArticle$this-load-library(email); $config[protocol] = smtp; //Send to QQ users , to display Chinese use iso-8859-1 $config[charset] = iso-8859-1; //Send to 163 users, to display Chinese use gb2...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template