Retrieve Unsubscribed Emails from Mailgun API

Using PHP cURL, my code to fetch unsubscribed emails from Mailgun returns an unexpected message.

function fetchEmails() {
    $chandle = curl_init();
    curl_setopt($chandle, CURLOPT_URL, 'https://api.mailgun.net/v3/example.net/unsubscribe_list');
    curl_setopt($chandle, CURLOPT_USERPWD, 'api:secretPass');
    curl_setopt($chandle, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($chandle, CURLOPT_HTTPGET, true);
    $responseData = curl_exec($chandle);
    curl_close($chandle);
    return $responseData;
}

What might be going wrong?

hey, maybe your endpoint is off, try checking if the route is correct. sometimes mailgun uses a diffrent path for unsubscribes. also, verify that your credentials r properly set.

The issue might be related to API endpoint configuration or insufficient error handling in your cURL settings. In my experience, enhancing error reporting with CURL_ERROR output can provide more clarity on what goes wrong behind the scenes. It would be beneficial to check if the API domain and version are correctly specified. I have found that discrepancies in the endpoint or an outdated API route can cause unexpected messages in the response. Additionally, verifying that all authentication details match exactly what Mailgun expects can help resolve the issue.