Question

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?

Était-ce utile?

La solution 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);

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top