Bogardo / Mailgun

Mailgun package for Laravel
MIT License
295 stars 115 forks source link

Using full api from mailgun-php #151

Open sinnbeck opened 5 years ago

sinnbeck commented 5 years ago

Had some issues with using the full api implementation in mailgun-php, but got it working by setting up Guzzle correctly. This allows you to use the full API on this page through Mailgun::api()

https://github.com/mailgun/mailgun-php/blob/master/doc/index.md

The updated code for the service provider

$this->app->bind('mailgun.client', function() {
            $headers['Authorization'] = 'Basic '.base64_encode(sprintf('%s:%s', 'api', config('mailgun.api_key')));
            return \Http\Adapter\Guzzle6\Client::createWithConfig([
                'base_uri' => 'https://' . config('mailgun.api.endpoint'),
                'headers' => $headers
            ]);
        });

Hope this helps someone

connecteev commented 5 years ago

@Resin01 what do you think of this approach instead? This worked for me. https://github.com/Bogardo/Mailgun/issues/156

sinnbeck commented 5 years ago

I am unsure what the improvement is ? Without guzzle being setup as specified, the API work work (at least it doesnt for me)