I am guessing this is pretty complicated to write by hand since you'd have to communicate between the email server and webserver. I would think that to do this you will need to have your own mail server on your webhost. You should create a dedicated email account on your webserver. Then you should be able to use PHP's mail extensions to connect to that email account on the mail server via POP (which is a pretty standard email protocol). I don't know of anything prebuilt but it is possible!