PHP code example of salines / cakephp-mail-interceptor
1. Go to this page and download the library: Download salines/cakephp-mail-interceptor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
salines / cakephp-mail-interceptor example snippets
use CakeMailInterceptor\CakeMailInterceptorPlugin;
public function bootstrap(): void
{
parent::bootstrap();
$this->addPlugin(CakeMailInterceptorPlugin::class);
}
'EmailTransport' => [
// Your real transport (used in production)
'smtp' => [
'className' => \Cake\Mailer\Transport\SmtpTransport::class,
'host' => 'smtp.example.com',
'port' => 587,
'username' => '[email protected]',
'password' => 'secret',
'tls' => true,
],
// Intercept transport (used in development/staging)
'default' => [
'className' => \CakeMailInterceptor\Mailer\Transport\InterceptTransport::class,
'transport' => 'smtp', // The underlying transport to use
'to' => '[email protected]', // Where all emails will be redirected
'subjectPrefix' => 'DEV', // Optional: tag for subject line
'