lean/meta/definitions/email.php

25 lines
801 B
PHP

<?php
use function DI\autowire, DI\create, DI\get;
use TheBugs\Email\EmailConfiguration,
TheBugs\Email\MailerInterface,
TheBugs\Email\SymfonyMailer;
return [
EmailConfiguration::class => function($c) {
$email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP );
$email->smtpHost = getenv('SMTP_HOSTNAME');
$email->smtpPort = getenv('SMTP_PORT');
$email->smtpUsername = getenv('SMTP_USERNAME');
$email->smtpPassword = getenv('SMTP_PASSWORD');
$email->smtpUseTLS = getenv('SMTP_TLS');
$email->toAddress = getenv("TO_EMAIL");
$email->fromAddress = getenv("FROM_EMAIL");
$email->fromName = getenv("FROM_NAME");
return $email;
},
MailerInterface::class => autowire(SymfonyMailer::class),
];