Page 1 of 1

Reading data from an email?

Posted: Mon Mar 07, 2005 3:26 pm
by spacebiscuit
Hi,

I've just found this forum which looks very busy and helpful. It is nice to find like-minded people as it sometimes can get a little lonely coding away all on your own!

Anyway I have a question. I want to know if there is a method that allows for test within an email to be interpretated and read by a php script. I know it is possible to email data input via a web form, but what about the other way around.

I don't think it is possible but I have a customer who would like this functionality built into his web page.

Any feedback would be appreciated.

Thanks,

Rob Burne.

8O

Posted: Mon Mar 07, 2005 4:44 pm
by Chris Corbyn
Read up on the imap functions

Namely imap_body() - BTW, although called IMAP they support POP3 too.

http://www.php.net/imap/

You can call an email body (well anything you like really, headers etc if you read all of the function list for imap_... ) and read it and play with it.

Let us know how you get on... I'll be interested since I recently started a generic POP3 and IMAP webmail app but then put it down and haven't picked it back up since I started some client work. I must go back to this and finish it :lol:

Posted: Thu Mar 10, 2005 6:41 pm
by spacebiscuit
Hi,

Thanks for the reply, I should be able to do exactly what I need to do with those functions so thanks again!

However thinking about my problem in more depth I now have a another question.

The data that will be sent in the emails which I want to read will be sent throughout the day at various and random times. Is there a way to have the script execute every x minutes to check the mailbox for new mail? I am guessing not as the php is only executed when a page is called or viewed right? Ideally I want to be able to leave the office in the knowledge that if an email is sent it is read by my script and the data stored.

Is this possible.

Thanks,

Rob.

Posted: Thu Mar 10, 2005 6:46 pm
by Chris Corbyn
Read up on cron jobs.

It's basically like using the windows task scheduler, but to run a php script or similar.

CPanel which most web hosts provide access to, generally has the option the schedule cron jobs.

Good luck! :wink: