收到电子邮件时触发事件

时间:2022-12-03 19:25:36

I'm trying to write something that puts the contents of the message on a queue, to have work done on it later. I've been messing around with IMAP IDLE with varying degrees of success.

我正在尝试写一些将消息内容放在队列中的东西,以便稍后完成工作。我一直在搞IMAP IDLE并取得了不同程度的成功。

I was wondering if anyone knows of a method to have a mail server receive an email, and then perform an action like posting the contents of the email to a URL endpoint.

我想知道是否有人知道让邮件服务器接收电子邮件的方法,然后执行诸如将电子邮件的内容发布到URL端点的操作。

Any ideas? Thanks!

有任何想法吗?谢谢!

2 个解决方案

#1


5  

Try fetchmail and procmail. You periodically poll the mail server (every minute if necessary) and use fetchmail to download from the IMAP server. Set up a procmail rule to run your notifier application on emails that match your selection criteria.

尝试fetchmail和procmail。您定期轮询邮件服务器(必要时每分钟一次)并使用fetchmail从IMAP服务器下载。设置procmail规则以在符合您选择条件的电子邮件上运行通知程序应用程序。

Any of the scripting languages (perl, python, tcl/tk etc.) have good, mature and easy to use email handler libraries (in fact you can get this sort of thing for most lanaguages), so it should be quite straightforward to write the handler in one of those.

任何脚本语言(perl,python,tcl / tk等)都有好的,成熟的,易于使用的电子邮件处理程序库(实际上你可以为大多数语言提供这种东西),所以编写它应该非常简单其中一个中的处理程序。

#2


0  

Configure the SMTP (mail transport) server to deliver the mail to an application that performs the desired action. Don't do it on the IMAP (mailbox client) level if you can avoid it.

配置SMTP(邮件传输)服务器以将邮件传递到执行所需操作的应用程序。如果可以避免,请不要在IMAP(邮箱客户端)级别上执行此操作。

#1


5  

Try fetchmail and procmail. You periodically poll the mail server (every minute if necessary) and use fetchmail to download from the IMAP server. Set up a procmail rule to run your notifier application on emails that match your selection criteria.

尝试fetchmail和procmail。您定期轮询邮件服务器(必要时每分钟一次)并使用fetchmail从IMAP服务器下载。设置procmail规则以在符合您选择条件的电子邮件上运行通知程序应用程序。

Any of the scripting languages (perl, python, tcl/tk etc.) have good, mature and easy to use email handler libraries (in fact you can get this sort of thing for most lanaguages), so it should be quite straightforward to write the handler in one of those.

任何脚本语言(perl,python,tcl / tk等)都有好的,成熟的,易于使用的电子邮件处理程序库(实际上你可以为大多数语言提供这种东西),所以编写它应该非常简单其中一个中的处理程序。

#2


0  

Configure the SMTP (mail transport) server to deliver the mail to an application that performs the desired action. Don't do it on the IMAP (mailbox client) level if you can avoid it.

配置SMTP(邮件传输)服务器以将邮件传递到执行所需操作的应用程序。如果可以避免,请不要在IMAP(邮箱客户端)级别上执行此操作。