Mailgun客户端凭据的Mailgun服务提供商

First of all, I know laravel already has a wrapper for Mailgun but laravel doesn't support Mailgun batch sending so I HAVE to use Mailgun php sdk in laravel which I finally got working, however I think having to do the following:

$mailgun = Mailgun::create(config('mail.mailgunSecret')); 

before sending the messages with mailgun is a little repetitive, with other API like Stripe I make a serviceprovider and instantiate it like this:

<?php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Stripe\Stripe;


class StripeServiceProvider extends ServiceProvider
{
    public function boot()
    {

        Stripe::setApiKey(config('services.stripe.secret'));

    }
}

But I don't know if I'm able to do something like this with mailgun since this is how I'm sending mails currently.

$mailgun = Mailgun::create(config('mail.mailgunSecret')); 

        $result = $mailgun->sendMessage(config('mail.mailgunDomain'), [
            'from' => config('mail.from'),
            'to' => $emails,
            'subject' => '%recipient.first% no te pierdas lo último de '.config('app.name'),
            'html' => $html,
            'recipient-variables' => '{ "example@gmail.com": {"first":"Gabriel", "id":1}, "example@gmail.com": {"first":"Silvia", "id":2} }'
        ]);

Any advice?

doushang8512
doushang8512 似乎是可信的。除了与maillist关联之外,永远不需要通过API发送批处理。Mailgun确实有API处理maillist的文档。这将是值得尊敬的路线。允许更新,创建和销毁可由一封电子邮件触发的maillist。
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问