1. 使用QQ邮箱

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.qq.com';
$config['smtp_user'] = '675667823@qq.com';
$config['smtp_pass'] = '************';
//授权码,不是QQ邮箱密码
$config['smtp_port'] = 465;
$config['smtp_crypto'] = 'ssl';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
//必须是双引号
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('675667823@qq.com', 'TEST');
//发送方
$this->email->to('leroiliu@163.com');
//接收方
$this->email->subject('SUBJECT');
//主题
$this->email->message('MESSAGE');
//邮件内容
$this->email->send();
//发送

2. 使用163邮箱

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.163.com';
$config['smtp_user'] = 'leroiliu@163.com';
$config['smtp_pass'] = '************';
//授权码,不是QQ邮箱密码
$config['smtp_port'] = 465;
$config['smtp_crypto'] = 'ssl';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
//必须是双引号
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('leroiliu@163.com', 'TEST');
//发送方
$this->email->to('675667823@qq.com');
//接收方
$this->email->subject('SUBJECT');
//主题
$this->email->message('MESSAGE');
//邮件内容
$this->email->send();
//发送

3. 使用腾讯企业邮箱

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.exmail.qq.com';
$config['smtp_user'] = 'app@loofii.com';
$config['smtp_pass'] = '******';
//授权码,不是QQ邮箱密码
$config['smtp_port'] = 465;
$config['smtp_crypto'] = 'ssl';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
//必须是双引号
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('app@loofii.com', 'TEST');
//发送方
$this->email->to('675667823@qq.com');
//接收方
$this->email->subject('SUBJECT');
//主题
$this->email->message('MESSAGE');
//邮件内容
$this->email->send();
//发送

本文早期发布于个人 CSDN 博客:查看原文

站内搜索

没有找到内容!