When email sent to my site,the following php script will run,I did it by Cpanel to run it when email sent.
I use this script to read email:
#!/usr/local/bin/php -q
<?php
$email = '';
$stdin = fopen("php://stdin", "r");
while (!feof($stdin)) {
$email .= fread($stdin, 1024);
}
fclose($stdin);
$email = file_get_contents('php://stdin');
?>
now if two emails received at same time in my web site,what happend?
is there any problem to reading it?
because this script is the same as reading file.
It should not be an issue to have two received simultaneously. The mail transport agent (MTA = postfix, sendmail, exim, etc) will queue them to deliver to your script. From your script’s point of view, even if multiple copies of it run as parallel processes, each individual process will receive its own STDIN input stream. They will not interfere with one another.
It really isn’t any different than your server’s MTA receiving mail and transferring it through some processing layer like Spamassassin or Procmail.