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' => '[email protected]', '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
And after this we can create email object where we want to send email and send email
$email = new Email('default'); $email->from(['[email protected]' => 'Welcome To Trinity']) ->to('[email protected]') ->subject('My Subject') ->send('Heloo ..');