In this case, the messages are received and stored by the mail server, so they can be processed later by applications. PHP Mail Client for Accessing Received Messages via POP3 or IMAPĪn alternative solution to process received e-mail messages using PHP is to associate the incoming addresses to mailboxes accessible using POP3 or IMAP client scripts. Therefore, you can read the message as if it was a file with name php://stdin, for instance like this: $message = file_get_contents( 'php://stdin' ) usr/bin/php /home/crm/bin/request.phpThe incoming message data is passed to PHP via the standard input. qmail file must contain the command that will be executed to start the PHP script that will handle the incoming messages.įor instance, if PHP CLI (Command Line Interface) version path is /usr/bin/php, and the path of the PHP script that will process the messages is /home/crm/bin/request.php, the. qmail file associated to the e-mail address that you want to handle.
#Scriptcase gmail read email how to#
To achieve this, you need to learn specific details of how to configure your mail server because each mail server works in a different way.įor instance, if you use qmail mail server, you need to setup a.
One way to process the incoming messages is to configure the local mail server to start a PHP script when a message arrives on a given mailbox. Starting a Script on Message Arrival to have PHP Process Incoming Email PHP can help in this situation by automatically receiving and performing the initial processing of the incoming messages. Some PHP applications need to handle incoming e-mail sent to a certain address and process the messages in a way that suits the application needs.įor instance, if you want to develop a simple CRM application (Customer Relationship Management), usually it needs to receive the messages sent by the customers to a given address and process them somehow.Ī typical e-mail processing script stores the message details in a database, so the messages can be handled later by a customer support representative.
#Scriptcase gmail read email code#
Download the POP3 Processing Email PHP Code How Can PHP Read Mail