下表为发送邮件时所有可用的参数。
1
public function email(){2
$this->load->library('email');3
4
$config['protocol'] = 'smtp';5
$config['smtp_host'] = 'smtp.163.com';6
$config['smtp_user'] = 'helloworld_assad@163.com';7
$config['smtp_pass'] = "*********"; //填写邮箱的 SMTP/POP 等的授权码8
$config['smtp_port'] = 25;9
$config['charset'] = 'utf-8';10
$config['smtp_timeout'] = 30;11
$config['mailtype'] = 'text';12
$config['validate'] = TRUE;13
$config['wordwrap'] = TRUE;14
$config['crlf'] = '\r\n';15
$config['newline'] = '\r\n';16
$this->email->initialize($config);17
$this->email->from('helloworld_assad@163.com','assad');18
$this->email->to('yulinying_1994@outlook.com');19
$this->email->subject('Email Test');20
$this->email->message("This is a eamil just testing the CI class");21
22
23
if($this->email->send()){24
echo 'the email is sent';25
}else{26
echo 'email sent fail';27
}28
29
}邮件message中取消自动换行:
1
{unwrap}http://example.com/a_long_link_that_should_not_be_wrapped.html{/unwrap}
异常报错可以使用以下生成调试报告
1
echo $this->email->print_debugger();
本文详细介绍CodeIgniter框架中发送邮件的配置参数,包括SMTP服务器地址、用户名、密码等,并提供了一个示例代码,展示了如何使用这些配置来发送邮件。

被折叠的 条评论
为什么被折叠?



