Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a php script that read an email from the server?

Tags:

php

email

is there any way that when i user send an email to [email protected] the php script reads the email's information and replay to the user automatically ?

EDIT :: is there any method that when someone send me an email to [email protected] a script will be called that's better than using cron job every 5 seconds

Cheer

like image 900
trrrrrrm Avatar asked Oct 14 '22 08:10

trrrrrrm


1 Answers

As already suggested, checking an e-mail box (POP3 or IMAP) is a valid way to process e-mail. However, if you're looking for realtime processing, it is indeed possible to have the mail delivered directly to php as standard input.

You basically tell the mail server to deliver the message to a local script.

You'll have to delve into CLI PHP, and configure your mail server (which will need to be on the same server as you processing script). So it's not an entirely simple process. But it is possible. I currently run a PHP powered e-mail discussion list using this method.

I configured my long ago, so I can't recall all the details; but this article should point you in the right direction.

like image 78
Tim Lytle Avatar answered Nov 01 '22 12:11

Tim Lytle