Mailgun icon indicating copy to clipboard operation
Mailgun copied to clipboard

Using full api from mailgun-php

Open sinnbeck opened this issue 5 years ago • 2 comments

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

sinnbeck avatar Feb 13 '19 12:02 sinnbeck

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

connecteev avatar Jun 19 '19 11:06 connecteev

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

sinnbeck avatar Jun 25 '19 12:06 sinnbeck