如何使用 mutt 写出电子邮件,grep 文件,然后在新电子邮件中执行命令
我正在尝试编写一系列脚本,这些脚本将根据刚刚收到的电子邮件中的文本在我的服务器上执行其他脚本。 我使用 mutt 作为基于文本的电子邮件客户端,但不知道从哪里开始。 我希望了解它是如何工作的,而不仅仅是解决问题,因为我的这个项目是为了好玩。 谢谢!
I am trying to write a series of scripts that will execute other scripts on my server depending upon text from an email that was just received. I am using mutt as a text based email client, but have no idea where to start for this. I am hoping to understand how this works more than just solving the problem, because this project of mine is for fun. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另一种选择(可能需要更多软件和/或访问权限,具体取决于您的服务器设置)是使用 procmail (或类似软件包之一)处理您的电子邮件,然后运行文本将电子邮件作为服务器端脚本的输入。
Another option (which will possibly require more software and/or access, depending on your server setup) is to use procmail (or one of the similar software packages) to process your email, and run the text of the email as input into your server-side scripts.
邮件列表软件基本上可以满足您的需求。 您可以通过向列表管理员发送特殊邮件来注册或从邮件列表中删除。 您可以查看开源 mailman 软件,看看他们是如何做到这一点的您的解决方案基于类似的方法。
Mailing list software does basically what you want. You can sign up or get removed to / from the mailing list by sending a special mails to the list manager. You can look at the open source mailman software to see how they do it and base your solution on a similar approach.
前面的答案是正确的,而且很可能是最简单的。
还有另一种可能。
我假设这个邮件帐户对应于一个linux/unix用户并且这个用户
有一个主目录。 在主目录中,您可以添加一个名为 .forward 的文件
然后您可以将所有传入邮件转发到另一个地址或将传入邮件通过管道传输到 shell 脚本。
.forward 文件 - 据我记得 - 应该具有执行权限以及
您正在转发电子邮件的 shell 脚本。
有用。 我过去曾这样做过。
the previous answer is correct and most probably the easiest.
There is another possibility.
I assume that this mail account corresponds to a linux/unix user and this user
has a home directory. At the home directory you can add a file called .forward
and then you can forward all the incoming mail either to another address or pipe the incoming mail to a shell script.
The .forward file -as far as I remember- should have execution permission as well as the
shell script you are forwarding your email.
It works. I have done this in the past.