【发布时间】:2014-11-25 15:42:37
【问题描述】:
我需要能够使用Laravel 4.2 和Mandrill 使用两个不同的API KEYs 发送电子邮件。
我遵循了以下教程,它与 SIGNLE API KEY(您在 services.php 中设置的那个)http://laravel.com/docs/4.2/mail 配合使用效果很好
我尝试使用以下代码即时设置不同的 API KEY(而不是使用 services.php 中的那个),但没有成功
如何在每次发送电子邮件时设置新的 API KEY?
App::bind('Mandrill', function()
{
return new Mandrill('API KEY');
});
App::bindShared('swift.transport', function()
{
return new MandrillTransport("API KEY");
});
// Sends Collection Email with the Unique Collection Code
Mail::send('emails.collect.collect', $data, function($message)
{
$message->from('info@domain.com', 'mr Smith');
$message->subject('22:24 EMAIL');
$message->to("jonathan@mail.co.uk");
});
【问题讨论】:
标签: laravel laravel-4 mandrill