Skip to content
This repository has been archived by the owner on Dec 22, 2019. It is now read-only.

Using full api from mailgun-php #151

Open
sinnbeck opened this issue Feb 13, 2019 · 2 comments
Open

Using full api from mailgun-php #151

sinnbeck opened this issue Feb 13, 2019 · 2 comments

Comments

@sinnbeck
Copy link

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
Copy link

@Resin01 what do you think of this approach instead? This worked for me.
#156

@sinnbeck
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants