我有一个客户,他有一台自托管的 2010 Exchange Server。他们希望自动回复功能仅在下午 5:00 到早上 8:00 之间自动开启。在这几个小时内,他们不希望设备上出现任何新邮件通知,但仍希望能够查看电子邮件。
是否可以配置 Exchange 来执行上述任何操作,或者是否有一些软件可以立即执行此操作?或者我需要开发自定义解决方案吗?
答案1
开箱即用,不是,但您可以使用 EWS 轻松进行编码。
使用 C# 为一个邮箱设置外出信息的示例;
static void SetOOF(ExchangeService service)
{
OofSettings myOOF = new OofSettings();
// Set the OOF status to be a scheduled time period.
myOOF.State = OofState.Scheduled;
// Select the time period to be OOF.
myOOF.Duration = new TimeWindow(DateTime.Now.AddDays(4), DateTime.Now.AddDays(5));
// Select the external audience that will receive OOF messages.
myOOF.ExternalAudience = OofExternalAudience.All;
// Set the OOF message for your internal audience.
myOOF.InternalReply = new OofReply("I'm currently out of office. Please contact my manager for critical issues. Thanks!");
// Set the OOF message for your external audience.
myOOF.ExternalReply = new OofReply("I am currently out of the office but will reply to emails when I return. Thanks!");
// Set the selected values. This method will result in a call to the Exchange server.
service.SetUserOofSettings("[email protected]", myOOF);
}
通过这个例子,你可以看到它很简单,你只需要使用一个管理员账户就可以冒充所有邮箱设置外出留言。
如果您不会编码,您也可以使用 curl 发送一些 XML。如下所示:使用 EWS 进行快速且简单的 UNIX Shell 脚本编写
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP1" />
</soap:Header>
<soap:Body>
<m:SetUserOofSettingsRequest>
<t:Mailbox>
<t:Address>[email protected]</t:Address>
</t:Mailbox>
<t:UserOofSettings>
<t:OofState>Scheduled</t:OofState>
<t:ExternalAudience>All</t:ExternalAudience>
<t:Duration>
<t:StartTime>2011-10-29T18:45:08.243Z</t:StartTime>
<t:EndTime>2011-10-30T18:45:08.243Z</t:EndTime>
</t:Duration>
<t:InternalReply xml:lang="en-US">
<t:Message>I'm currently out of office. Please contact my manager for critical issues. Thanks!</t:Message>
</t:InternalReply>
<t:ExternalReply xml:lang="en-US">
<t:Message>I am currently out of the office but will reply to emails when I return. Thanks!</t:Message>
</t:ExternalReply>
</t:UserOofSettings>
</m:SetUserOofSettingsRequest>
</soap:Body>
</soap:Envelope>
另一方面,设备通知是另一回事,是设备本身发出推送通知,而不是 Exchange。对于这部分,我无能为力。