Parsing Email using PHP

software development

#1

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!

Aaron


#2

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

$socket = fsockopen(“ssl://pop.gmail.com”, 995, $errno, $errstr, 200);
$output = fgets($socket, 128);
fputs($socket, “USER address@gmail.com\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.

Cheers,
~William

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]


#3

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?

Thanks,
Kevin


#4

You might be interested in this article:

http://www.phpbuilder.com/columns/galloway20021105.php3?aid=422

Terry