There is a lot of solutions out there that will enable you to capture mail in various languages.
I am most familiar with doing this in cpanel, but you seem to be familiar with setting it up manually so the only piece you are missing is the code?
If so take a look at this article http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail
There are more in depth libraries that will separate the body and recipient/sender emails so you can have all these parts in a clean fashion.(Which on also given in the example)
After you get the senders email of a non-existent email you can use PHP's mail function to let them know no mail can go to the recipient because they don't exist.
If you want to validate an email address exists here is a working example, but it uses SMTP.. and PHP not sure if this is what your going for.
Overall I think with these examples you can get a working code sample with some tweaking and testing.
Hope this helps. Let me know if you need more help.
To do this in cpanel go to "Default Address" then go to "Advanced Options" then go to "Pipe to Program" then you want to put in the path to the PHP or language script/program you want to use.