可以通过编程方式更改 IIS 的 SMTP 服务器“智能主机”
我最近发现了一种在 SMTP 电子邮件实际离开 SMTP 服务器之前对其进行审核的方法。这是通过将“智能主机”值更改为命名
- 为不存在的主机
- 少于 15 个字符
- 名称中没有句点
这允许我使用 Outlook Express 查看邮件、检查文件附件以及通过 System.Net.Mail
以编程方式生成的其他内容
我通过更改此内容来发布邮件为有效值并重新启动 SMTP 服务。
问题
我如何以编程方式更改此值,以便可以控制这些电子邮件的排队、审核和发布?
I recently discovered a way to audit SMTP emails prior to them actually leaving the SMTP server. This is accomplished by changing the "Smart Host" value to something that is
- Named a host that doesn't exist
- Less than 15 characters
- Has no periods in the name
This allows me to view the messages with Outlook Express, check the file attachments, and other programatically generated content through System.Net.Mail
I release the messages by changing this to a valid value and restarting the SMTP service.
Question
How can I programatically change this value so I can allow for the controlled queueing, audit, and release of these email messages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 IIS WMI 提供程序以编程方式执行此操作。 SmartHost 属性可以在IIsSmtpService 或 IIsSmtpServer 对象。在 Windows Server 2008 上,您需要安装 IIS 6.0 WMI 兼容性。像下面这样的东西应该有效。
You can programmatically do this using the IIS WMI Provider. The SmartHost property can be found on either the IIsSmtpService or IIsSmtpServer object. On Windows Server 2008 you will need to install IIS 6.0 WMI compatibility. Something like the following should work.
哎哟!一种方法可能是仅创建一个直接编辑元数据库的程序,然后重新启动 SMTPSVC。我确信有一种使用 WMI 的方法,但我不知道。
顺便说一句,您可以通过编辑 app.config/web.config 将文件放入您选择的文件夹中,从而进入“其他”方向:
http://msdn.microsoft.com/en-us/library/ms164241.aspx
检查电子邮件后,您可以移动将它们添加到 IIS 的队列中。
Ouch! One method might be to just create a program that directly edits the Metabase, and then restarts SMTPSVC. I'm sure there's a way with WMI, but I don't know offhand.
By the way, you might be able to go in the "other" direction by editing your app.config/web.config to drop the files in a folder of your choice:
http://msdn.microsoft.com/en-us/library/ms164241.aspx
After you inspect the emails, you can move them to IIS's queue.