<?php
namespace App\Controllers\Test;
use App\Controllers\BaseController;
class Email_test extends BaseController {
public function getIndex() {
$email = \Config\Services::email();
$email->setFrom('info@colormoon.in', 'Info');
$email->setTo('manikanta@thecolourmoon.com');
$email->setSubject('Test Email from CodeIgniter 4');
$email->setMessage('This is a test email sent using CodeIgniter 4.');
if ($email->send()) {
return 'Email successfully sent.';
} else {
return 'Error in sending email: ' . $email->printDebugger(['headers']);
}
}
}
For more details refer : https://codeigniter.com/user_guide/libraries/email.html
0 comments:
Post a Comment