Have the reply to address set up to go straight into a mailbox that you can access using PHP's imap_open to access and read emails. Armed with that, it should be a simple matter to insert the data as required into a database.
<?php
$mbox = imap_open("{imap.example.org:143}", "username", "password");
echo "<h1>Mailboxes</h1>
";
$folders = imap_listmailbox($mbox, "{imap.example.org:143}", "*");
if ($folders == false) {
echo "Call failed<br />
";
} else {
foreach ($folders as $val) {
echo $val . "<br />
";
}
}
echo "<h1>Headers in INBOX</h1>
";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "Call failed<br />
";
} else {
foreach ($headers as $val) {
echo $val . "<br />
";
}
}
imap_close($mbox);
?>
The full list of PHP IMAP functions is very thorough.