문제

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