开发者

Adding / Removing values for an Email based daily stock value reporter - made inPHP

开发者 https://www.devze.com 2022-12-31 10:59 出处:网络
i\'m buidling a very simple email based website that users can, when registering list out all the stocktickers they\'re intersted in following. The program then on a daily basis goes and fetches that

i'm buidling a very simple email based website that users can, when registering list out all the stocktickers they're intersted in following. The program then on a daily basis goes and fetches that information and sends it out to every user. i have the portion which fetchs the information from the stock websites, but i'm looking for an "infrastructure" that allows:

(a) a user to send an email to service@stockreporter.com with the subject "Subscribe" and with the bod开发者_运维知识库y containing stockticker values,

(b) user to send email to service@... with subject "unsubscribe" and body containing similar values.

Looking for code in php please. Any insights?


Create a php script and "pipe" emails sent to the specified email addresses into it.

An example tutorial is available here - http://www.evolt.org/incoming_mail_and_php

This way, the script is triggered, on demand, when a subscriber contacts it to either add subscriptions or remove them. The script can then parse the contents of the email, along with the header (which would contain the sender's email address, subject, etc.) and make the required changes within your system.

A suggestion such as that from Galen would also work, however, having a script which polls an email account at regular intervals (using cron, or similar), in my experience is not as reliable or as instantaneous as piping email to a script.


Create a php script that constantly checks that email address. When it receives an email it can use the senders email for identification and then just parse the email to run the specified command for that user

http://php.net/manual/en/book.imap.php

0

精彩评论

暂无评论...
验证码 换一张
取 消