mailgun / mailgun-php

Mailgun's Official SDK for PHP
http://www.mailgun.com
MIT License
1.09k stars 314 forks source link

Bounces: The endpoint you have tried to access does not exist. #872

Closed DePalmo closed 10 months ago

DePalmo commented 11 months ago

Hello,

I'm having a bit of a problem with this library. I'm using v3.6.0 and when doing a suppressions()->bounces()->show(domain, email) call, it's returning this error: The endpoint you have tried to access does not exist. Check if the domain matches the domain you have configure on Mailgun.

The domain does exist, since if I call suppressions()->bounces()->index(domain), I get back all bounces there are for the selected domain. If I call domains()->index(), I see the domain listed and the name is the same.

This is my exact code:

$mg = Mailgun::create(config('app.mailgun_api_key'), 'https://api.eu.mailgun.net');
//dd($mg->domains()->index());
//dd($mg->suppressions()->bounces()->index(config('app.mailgun_domain')));
dd($mg->suppressions()->bounces()->show(config('app.mailgun_domain'), $email));

Where email is in format my.name@domain-we-own.com. And yes, the domain was created for EU and in dashboard I have an EU flag in front of it. I did out of curiosity try the api.mailgun.net (aka US server), but had the same issue.

oleksandr-mykhailenko commented 10 months ago

Hello @DePalmo This string $mg = Mailgun::create(config('app.mailgun_api_key'), 'https://api.eu.mailgun.net'); does not look correct. Please, check correct domain. It must be your unique domain

mikegreen commented 8 months ago

Actually @oleksandr-mykhailenko the instantition there is the Mailgun region API domain. $mailgun = Mailgun::create($mailgunApiKey, $mailgunDomain);

Then you specific your domain in each endpoint:

// Get events
$response = $mailgun->events()->get($sendingDomain, [
    'event' => 'failed',
...