Skip to content

Instantly share code, notes, and snippets.

@piotrpog piotrpog/app.php
Last active Mar 9, 2019

Embed
What would you like to do?
Config for connecting to SMTP server with Craft CMS. More info on http://craftsnippets.com/articles/testing-and-debugging-emails-sent-by-craft-cms-using-mailtrap
<?php
return [
'components' => [
'mailer' => function() {
$settings = \craft\helpers\App::mailSettings();
$settings->transportType = \craft\mail\transportadapters\Smtp::class;
$settings->transportSettings = [
'useAuthentication' => true,
'host' => getenv('SMTP_HOST'),
'port' => getenv('SMTP_PORT'),
'username' => getenv('SMTP_USERNAME'),
'password' => getenv('SMTP_PASSWORD'),
];
$config = \craft\helpers\App::mailerConfig($settings);
return Craft::createObject($config);
},
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.