Last active
March 19, 2017 20:36
-
-
Save sohelrana820/530e0067a4c7d6474239632ffc2d807f to your computer and use it in GitHub Desktop.
Configure email transporter in CakePHP in runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment