hey everyone, im new here. basically i want to be able to do the following: have a system set up which, when an email from a particular domain is recieved, it is converted into html and put into a database, with certain parameters set such as which domain it was from, what the subject line is etc. is this possible? and is their such a system available already? thanks joe
steps for your system in php - read email box with imap_xxxx functions - grab your email body (imap_xxxx) - then do whatever you want with it. $mbox = imap_open("{domain.com:110/pop3}INBOX", "username", "password"); if ($mbox != FALSE) { $nrMessages = imap_num_msg($mbox); for ($i=1; $i <= $nrMessages; $i++) { $body_header = imap_fetchbody($mbox, $i, '0'); $body = imap_fetchbody($mbox, $i, '1'); $bodyLines = split("\n", $body); echo $toEmail . "\n"; // Delete this email imap_delete($mbox, $i); } imap_expunge($mbox); } PHP: I hope this help
im not particularly familar with php so sorry for the rather basic reply. Would by inserting that into a web page, would firstly it add the results into a mysql database? Is their a way of attaching a date to it?! If i was to test out that code, would i simply insert it into a webpage, and change the domain.com to my domain, and the login details would i be good to go?! thanks for your replys cheers joe
I haven't worked with PHP's IMAP stuff, and it's been ages since I paid attention to mail handlers, so I can't comment on the questions you ask here. But there's one other piece you'll need: something to poll for the email. So, if you set that PHP script up as a command line app, you really should set up some sort of job to run that script periodically (however often you think you'll need to check the mail). If you put it into a web page, the same sort of thing applies. You'll have to refresh that page to check the mail. Depending on the big picture of what you want, and what you have available, there might be better ways to do this.