Attach Processing to Incoming Emails

Finally fixed it - stupid errors in the database processing in the script.

Final PHP script that works:

#!/usr/local/bin/php
<?php

$fd = fopen('php://stdin','r');
$email = '';
while (!feof ($fd)) {
  $email .= fread($fd,1024);
}
fclose($fd);

$db = new mysqli('localhost', 'user', 'password', 'dbase');
$stmt = $db->prepare('INSERT INTO emailImages (email) VALUES (?)');
$stmt->bind_param('s',$email); 
$stmt->execute();
$stmt->close();