mailgun not sending data to the given URL

By : Mark

I have created an account on mailgun. I sent one mail from my email address to say:

[email protected]

I have configured the account to forward all mails to

"http://project_name/controller_name/action_name" (in case of zend)

But its not showing any data in my controller/action

Following is my code for getting data:

    print_r($_POST); //its showing blank array

        echo 'if';
        echo $_REQUEST['HTTP_RAW_POST_DATA'];
    } else {
        echo 'else';
        echo $HTTP_RAW_POST_DATA;

I am new to mailgun and dont know much about it. How can I deal with this issue?

By : Mark


print_r() is used for printing to the screen. Since the web hook handler is posting to your script, the handler saw the posted data, but you didn't. ;)

You should store the data by serializing the array and storing it in a file.

Mailgun cannot POST messages to localhost .U need to migrate your project to an online server.Right now, the route you have provided is of your localhost server,there is no way for mailgun to access that .

This video can help you solving your question :)
By: admin