duanliao6077 2010-10-29 01:28
浏览 249
已采纳

寻求(PHP)代码来获取电子邮件,解析它并采取行动

Before I probably reinvent the wheel, can anyone tell me if there exists a FOSS code library to check email on a regular basis (or driven by a cron job), to parse the title and body and to perform certain functions (mainly sending other emails).

I was thinking PHP as it is server side and good at string handling, but I would be happy enough with C or C++.

Hmmm, why am I even thinking server side? I suppose that it could just as well run on my PC (add Delphi, C++ Builder and maybe C# or even VB) as possibilities (sorry & no offence intended; I know that it is well suited for string processing, but I don't know PERL and don't rally have time to learn).


Edit: I'm think of some common code which allows to define "triggers" and register callback functions. So, a trigger might say that sender = XXX, title contains, To address is, etc (or combinations thereof) and I can register a callback function which I code which will do the appropriate processing when the condition(s) is met.


Edit: found on SourceForge "ETODB is a free PHP class which allows to parse and extract data from emails to integrate with other php applications. You can automatically parse email messages and convert email to database records, save attachments to specific folders, browse log." http://sourceforge.net/projects/etodb/

  • 写回答

2条回答 默认 最新

  • 普通网友 2010-10-29 09:26
    关注

    The imap lib comes as standard with PHP - rolling your own code around this is trivial.

    However polling the email is a very inneficient way to solve the problem - a far better approach is to route the email (or a copy thereof) direct to your script - but you don't say what Operating system you are running on nor which MTA your are using. Assuming it all sits on a Unix box running sendmail or similar, most local delivery agents allow ~/.forward to reference a script. My personal preference is for procmail (which is efectively a programming language for delivery mail, making copies, auto-responses etc).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法