Вопрос

Is is possible to set more accounts for Mail in Laravel 4? If I'm right, for the Mail facade I can set only one SMTP account in app/config/mail.php file. But in my application I need to send emails from two different SMTP accounts. I’m rewriting it from Symfony framework and as Symfony uses plain Swiftmailer it is very easy to set separate account credentials for every action. How could I do the same in Laravel?

Это было полезно?

Решение 2

This let's me change mail instantiation:

$transport = SmtpTransport::newInstance('smtp.gmail.com', 25);
$transport->setEncryption('tls');
$transport->setUsername('ladislav@gmail.com');
$transport->setPassword('xxxxxx');
$swift = new Swift_Mailer($transport);
Mail::setSwiftMailer($swift);

Другие советы

What do you need to change? If its just the address or name see here, you can change the swiftmailer properties with that command

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top