Parsing Email using PHP

software development


I am attempting to add a feature to one of my websites that would allow users to update their account by sending a text message to a specified emaill address from their mobile phone. Ideally, I would have a php script that is set up to run as a cron that would parse through any emails sent to this particular email address and perform the necessary functions. However, DreamHost does not have the IMAP function compiled into PHP, so I am unable to use those.

Does anyone know of any different methods to accomplish what I have described (without the availability of the IMAP functions)?

Thanks in advance for any help!



I’ve done this using sockets and weeding/parsing through the reponses - a fun project indeed:

$socket = fsockopen(“ssl://”, 995, $errno, $errstr, 200);
$output = fgets($socket, 128);
fputs($socket, “USER\n”);
$output = fgets($socket, 128);
fputs($socket, “PASS mypassword\n”);
$output = fgets($socket, 128);
fputs($socket, “LIST\n”) //get the mails in queue
fputs($socket,"RETR … and you’re on your way!!!

I think I got most of my info from the fsockopen php manual.


Rails Hosting - DH supports Ruby on Rails!
[color=#CC0000]Tip - use the DreamHost promo code X50 to get $50 off any of their plans instantly[/color]


I’m trying to do the same thing, and Dreamhost still does not support IMAP functions. Were you able to find a solution for processing inbound email?



You might be interested in this article: