There are a couple of ways to do it. On a *nix box you can have the
incoming messages aliased to a process (i.e. your PHP script) which
will run as soon as the message is received. This is fairly straight
forward but if you don't have your script set up correctly you may
lose your incoming messages, and it can also be difficult to test and
debug. If you search this group I'm fairly certain doing this has been
covered before.
The other way is batch it via cron (as you've suggested) using a mail
library. The PHP IMAP functions can be used for this, although I'm
sure there are plenty of others which may possible be easier to use.
Check the PHP manual
http://nz.php.net/imap
and I've also written a number of articles about using IMAP. A couple
that should help are
http://www.electrictoolbox.com/php-imap-download-email/
and
http://www.electrictoolbox.com/extract-attachments-email-php-imap/
Regards,
Chris
2009/10/2 Brendan Brink <[email protected]>:
> Hi there,
>
> I am wanting to know what is the best way to receive emails at an email
> address and extract information from the email on the fly and process them
> via a PHP script?
>
> basically i am wanting a client to send a message through an email to say
> '[email protected]' and i set up a cronjob to process each email that
> arrives at this address via a php script.
>
> any help or direction would be greatly appreciated...
>
> cheers
> brendan.
>
> >
>
--
Chris Hope
The Electric Toolbox Ltd
Email: [email protected]
Web: www.electrictoolbox.com
Phone: +64 9 522 9531
Mobile: +64 21 866 529
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---