In this section, we’ll see how to send email using email library.
To send the email, first we need to load the email’s service.
$email = \Config\Services::email(); // email() is static method of Services class. $email->setFrom('from@example.com', 'Your Name'); $email->setTo('to@example.com'); $email->setCC('cc@example.com'); $email->setBCC('bcc@example.com'); $email->setSubject('Email Subject'); $email->setMessage('Message'); $email->send();
That’s it!. Please share your thoughts or suggestions in the comments below.