mailgun-php: Your credentials are incorrect

i have problem when load this code ten mb browser give me error like this “Your credentials are incorrect”

this is my code


use Mailgun\Mailgun;
require '../vendor/autoload.php';

$mg = Mailgun::create('key-xxx');

$mg->messages()->send('sandboxxxx.mailgun.org', [
  'from'    => 'h@gmail.com',
  'to'      => 'hb@gmail.com',
  'subject' => 'The PHP SDK is awesome!',
  'text'    => 'It is so simple to send a message.'
]);

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

The issue was that I was under an incorrect assumption about the whitelisting feature. I whitelisted my server IP that I was using the SDK from, but this was causing the incorrect credentials error. I was simply incorrect in whitelisting my server IP. To anyone having this issue, try debugging without a whitelist of IPs.

I thank MailGun support and definitely David for taking the time to help narrow down such a silly issue on my part. Hopefully this helps anyone else with such an issue - at least to narrow theirs down.