我想要的是一项允许任何电子邮件发送到我的网站的服务(最好没有安装在服务器上,例如让第三方处理电子邮件,但如果需要专用服务器,我会尝试一下)作为 HTTP 请求重定向到我指定的 php 脚本
例如像这样的电子邮件
To: [email protected]
From: [email protected]
Subject: hello!
Message: Hey man whats up?
会发出 http 请求
http://example.com/notify.php
带有一些 POST 数据:
[email protected]&[email protected]&subject=hello!&message=Hey man whats up?
我想避免每分钟轮询,因为我相信这将是一个主要的消耗在服务器上。是否有任何现有的邮件服务器或服务具有此类功能?我的另一个计划是实现我自己的邮件服务器,但这似乎是一个巨大的项目来支持这一点。
What I would like is a service (preferably something not installed on a server like just letting a third-party handle e-mails but if a dedicated server is necessary I'll give it a shot) that allows any e-mails to my site to be redirected as a HTTP request to a php script I specify
For example a e-mail like this
To: [email protected]
From: [email protected]
Subject: hello!
Message: Hey man whats up?
Would make a http request to
http://example.com/notify.php
With some POST data:
[email protected]&[email protected]&subject=hello!&message=Hey man whats up?
I'd like to avoid polling every minute as I believe this would be a major drain on the server. Is there any pre-existing mail server or service that has these sort of features? My other plan would be to implement my own mail server but that seems like a huge project to undertake just to support this.
发布评论
评论(2)
在 MTA 中设置管道别名:
此时,您可以让脚本解析电子邮件并打开一个 URL,并将其正确编码到查询字符串中。或者它可以直接处理电子邮件。
Set up a pipe alias in your MTA:
At that point you can have your script parse the email and open a URL with it properly encoded into the query string. Or it could just process the email directly.
每分钟轮询邮件服务器以检查收件箱不应该成为系统的主要消耗。大多数电子邮件客户端正是这样做的。如果电子邮件服务器是 IMAP、POP3 或 NNTP,并且您想使用 PHP 查询收到的邮件,则可以使用 PHP 的 IMAP 扩展。
Polling a mail server every minute to check an inbox shouldn't be a major drain on the system. Most email clients do exactly that. If the email server is IMAP, POP3, or NNTP, and you want to use PHP to query for received mail, you could do the polling using the IMAP extension for PHP.