How to integrate PHPMailer with CodeIgniter 4
The PHP mail function nowadays only serves for internal testing.
Any SMTP server will reject emails from an unauthenticated account.
First, register an account in Gmail, and then in the configuration of the Security section account, enable "Less secure app access"
Now every time you want to send an email you do it with that account, attached an example below.
Anyway, using PHPMailer is the best option.
- if (!empty()) {
- = 'ssl://smtp.gmail.com';
- = '465';
- = '[email protected]';
- = 'your-mail-password';
- = ;
- = 'Web Form';
- = '';
- = false;
- foreach ( as => ) {
- .= strtoupper() . ': '. . "\r