If you do not want to run full smtp server packages like postfix, exim4, then fakeSMTP fit your needs. Following is description from website
fakeSMTP is a PHP script written to act like any traditional postfix SMTP server. Used in conjunction with inted, the script is called when a mail client connects to port 25 on the server.
This script does not actually send any emails (although this could theoretically be combined with sendmail if one wanted to). It also does not contain any authorization functionality, and thus acts solely as a badly configured open SMTP relay. I wrote it to create a honeypot for spammers as well as for testing & proof of concept.
fakeSMTP.php can be download from the link provided. The modify /etc/inetd.conf as follow
smtp stream tcp nowait root /path/to/fakeSMTP.php
Basically all incoming smtp connection will be handled by fakeSMTP.php. You should incorporate your script into fakeSMTP.php. Base on the following example
$hp = new fakeSMTP;
$hp->serverHello = 'axllent.org ESMTP Postfix'; // Server identity (optional)
$hp->logFile = '/tmp/emails.log'); // Log the transaction files (optional)
$hp->receive();
if (!$hp->mail['rawEmail']) exit; // Script failed to receive a complete transaction
/* The script returns all the mail parts which you can process in $hp->mail(array) - read source for all details */
Your script should make use of $hp->mail(array)
for email processing.
I didn't look at the code but you may have to modify it to only accept email of your domain.
As Sirch mention in comment, you may receive huge volume of spam mail, as this script/library do not incorporate RBL, address checking nor amavis/spamassassin. It maybe a bit of work if you are going to incorporate them in your own script.
If you end up decided to use postfix, for RBL, amavis/spamassassin integration, you can follow the answer in HERE.