Powershell - MS Exchange 电子邮件自动回复器
目前,我们遇到一个问题,即我们收到大量退回的电子邮件(来自自动生成的电子邮件),这些电子邮件来自指定电子邮件地址无效的用户(失败通知)。我需要识别邮箱中的某些邮件并自动回复它们 - 作为 Powershell 的新手,我有点挣扎!我想我了解如何检查字符串的出现,但我不知道如何遍历收件箱以依次查看/获取每条消息的句柄,并且我不知道如何提取主题或正文文本以便分析内容并执行字符串比较。我担心这应该很容易 - 但我在网上找不到任何可以完成这项工作的东西 - 有人可以帮忙吗?
We've currently got an issue where we're receiving a lot of bounced e-mails (from an auto generated e-mail) back from people where a specified e-mail address is not valid (failure notice). I need to identify certain messages in the mailbox and respond automatically to them - as a newbie to Powershell I'm struggling a bit! I think I understand how to check for the occurrence of a string but I don't know how to iterate through an inbox to look at/get a handle on each message in turn and I don't know how to extract the subject or body text in order to analyse the contents and perform a string comparison. I fear this should be easy - but I can't find anything on the web that might do the job - can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以只是为了澄清你在寻找什么。
邮箱A收到大量故障通知/退回邮件。
您希望您的 powershell 脚本在邮箱 A 中搜索主题行(或邮件正文)包含“String X”的每个实例,如果存在匹配项,请采取一些操作?
另外,您使用的是哪个版本的 Exchange?您至少需要使用 2007 年版本才能使用 Exchange Command Shell。然后,您将需要查看可以运行的命令外壳命令。
查看 Exchange 邮件跟踪日志,并将运行的一个命令的结果通过管道传输到下一个命令。像这样思考...
(运行命令)| (对第一个命令的结果运行另一个命令) | (对第二个命令的结果运行最后一个命令)。
您可以在我的网站上查看示例:
http://www.technoctopus.com/?p=223
虽然不完全相同,它可能会让你朝着正确的方向前进。
So just to clarify what you're looking for.
Mailbox A receives a large number of failure notice/bounce messages.
You'ld like your powershell script to search Mailbox A for every instance where the Subject line (or message body) contains "String X" and if there is a match, take some action?
Also, what version of Exchange are you using? You need to be at least on 2007 to use Exchange Command Shell. You'll then want to look over the Command Shell commands that can be run.
Look at the Exchange Message Tracking Log, and Pipe the results from one command you run to the next. Think of it like this...
(Run a command) | (Run another command on the results of the first command) | (Run a last command on the results of the second).
You can view an example on my website at:
http://www.technoctopus.com/?p=223
While not exactly the same, it might get you moving in the right direction.