These little things you forget can drive you nuts.
curl_setopt($curl, CURLOPT_USERPWD, 'key-mailgunkey');
shoud be prefixed with "api:" as follows
curl_setopt($curl, CURLOPT_USERPWD, 'api:key-mailgunkey');
and that was the difference that broke the camels back