[Phpwm] Email to Database application

Dave Brotherstone davegb at pobox.com
Mon Oct 12 13:56:05 UTC 2009


> You can simply setup a pop box that the returns would be sent to, then
> with php read the mailbox and parse the messages.
>
> http://framework.zend.com/manual/en/zend.mail.read.html
>
> Other option would be to pipe the mails into a php script at the mail
> server, this is more complicated, pop is much easier....
>
>
If it's your server that the mail is going to, it's actually not that
complicated to setup, and  doesn't require polling of the pop mailbox.  For
exim, you can just set the "command" option in the transport, if you've got
a separate domain for your replies. Otherwise I think it's just a .forward
to |your_command_here.  I've done it a while ago for a single address, and
it was pretty easy.

Reading through a pop box could have some interesting side effects - a)
you're going to need a lock on the polling action, b) you're going to have
to cope with crashing mid-poll.  i.e. if the remote end hangs up on you,
have you deleted the messages you've processed etc.

You can avoid those sorts of problems having the mail go directly to your
script. - If the worst happens and your code crashes mid-receive (less
likely as you're not reliant on an external connection), you've only
lost/screwed that one message.

There may be other ways to do it too that maybe others will know.

Cheers,
Dave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20091012/9b87ce11/attachment.htm 


More information about the Phpwm mailing list