If you are working with cakephp 3 and need to send email then this tip help you to send email.
Step 1. Go to your app.php and find EmailTransport and add your SMTP details
'EmailTransport' => [ 'default' => [ 'className' => 'Mail', // The following keys are used in SMTP transports 'host' => 'My_HOST', 'port' => 25, 'timeout' => 30, 'username' => 'no-reply@trinitytuts.com', 'password' => '******', 'client' => null, 'tls' => null, 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), ] ],
Step 2. Now we can include cakephp default mailer class to send email
use Cake\Mailer\Email;
And after this we can create email object where we want to send email and send email
$email = new Email('default'); $email->from(['no-reply@trinitytuts.com' => 'Welcome To Trinity']) ->to('aneh@trinitytuts.com') ->subject('My Subject') ->send('Heloo ..');
Done 🙂