I'm currently connecting to Mailgun's webhooks so I can get any emails sent through and pass it somewhere else.
I've managed to deal with the subject, from and body inputs of the API, but I'm currently having trouble grabbing any attachments to an email.
Mailgun says that they send through a multipart file, but I have tried to catch it and write out the info into a file, but it comes back as an empty array...
$file = fopen(__DIR__ . '/files.txt','w') or die("Can't open file.");
ob_start();
var_dump($_FILES);
fwrite($file, ob_get_clean()) or die("Can't save to file.");
fclose($file);
Within the Post information, I get an attachments parameter which has such things like a url, content-type, name etc. I have tried to go the the url of each attachment, but I get a login box asking for a username and password and says "Server says: MG API". I have no idea if I need to pass something here so I can retrieve the attachment as a file to pass it on.
If anyone could help me out here, then I would truly appreciate it.
Thank you.