Sending emails is a common task in web applications. In PHP, the CodeIgniter (CI) framework provides a convenient Mail class that enables us to send emails easily. This article will introduce how to use the Mail mail class in the CI framework to send emails and provide the corresponding source code.
- Configure email settings
To use the CI framework to send emails, you first need to make the corresponding settings in the CI's configuration file. Open the file in the CI project application/config/config.php
and find the following settings:
$config['protocol'] = 'smtp'; // 邮件协议
$config['smtp_host'] =