Q:

Get data whenever email is sent to an email id and update db with email information

I am trying to write a webservice and configure my webserver such that whenever I send an email to xyz@domain.com, it should make an API call store email details in DB. I was using Cloudmailin to implement similar functionality before but now I want to convert it to native PHP webservice. Any help would be appreciated.

A:

See http://harrybailey.com/2009/02/send-or-pipe-an-email-to-a-php-script/ for information on how to configure a mail server to accept incoming messages for your domain, and pipe each incoming message to a PHP script.  Then, your PHP script can parse the headers and body of each incoming message as they arrive.

