If you are looking for a solution to configure email transporter from CakePHP controller, components in run-time. This script will help you lot. This script is working for CakePHP 3.1.X – 3.3.9.
Email::configTransport('transporter_name', [ 'className' => 'Smtp', 'host' => 'SMTP_HOST', 'port' => 'SMTP_PORT', 'timeout' => 30, 'username' => 'SMTP_USERNAME', 'password' => 'SMTP_PASSWORD', ]); $email = new Email(); $email->transport('transporter_name'); $email->from('no-replay@example.com') ->to('to@example.com') ->subject('Dummy Subject') ->message('This is a test message') ->send();
Simply copy paste this snippet and modified with real information and test it.