Q Is it possible to script Apple’s Mail to send an automated response, such as an ‘out of office’ reply, to all incoming email according to the date and time of its arrival? Or is this only available in a Microsoft Exchange Server?
A Out of office (OoO) auto-responses are not normally implemented in a mail client, because the mail client is commonly only used to download, read, and send mail.
Thus the times that you might want to send an OoO response are precisely those that your mail client will not be in use, because you are not there. Accordingly, these are normally set in the mail server.
This is not by any means confined to Exchange Server, and the mail server built into Yosemite Server and third-party server products invariably come with sophisticated OoO features. These are not normally scripted in the way that you intend, but turned on manually in response to user requests. However there is no reason that a good sysadmin should not be able to script such behaviour.
Mail can be set to send an auto-response using its Rules feature, and this could be set to run an AppleScript. The more ingenious will no doubt devise a way in that script to check the time, thus determine whether to send the response, or perform a null action. However this is contrived and messy, and not a good solution.
Few ISPs offer OoO facilities that you can control, let alone script. Even powerful third-party mail clients such as Mailsmith do not offer this feature. If you really need it, the best solution if you are running Yosemite is to purchase the inexpensive Yosemite Server 4.1, and go about learning how to configure the OoO feature in its mail server. However you will then need to run your own mail server locally, probably making the end benefit not worth all the effort.
Updated from the original, which was first published in MacUser volume 27 issue 24, 2011.