创build了一个Exchange电子邮件帐户,通过它我将每天收到三封不同的Excel附件的电子邮件。
每个Excel附件必须保存在三个不同文件夹中的一个中。
可以将Exchange Serverconfiguration为自动执行此操作,还是必须编写脚本来监视帐户是否有新电子邮件?
我相信这是一个Exchange 2007服务器。
我目前正在使用一个python脚本来达到这个目的,它会login到mailbow中,然后下载附件和备份电子邮件,这些mods可能很适合你的需求,如果你愿意,可以用py2exe编译它。 这是代码 。
PS:这个代码是由Suresh Kesmar写的(所有学分都是他的)Orignaly;)
恐怕你必须用脚本来完成,因为Outlook喜欢保护你自己。 以下说明来自这里 。 我修改了一些适用于您的Excel电子表格。 请记住,如果他们来自Excel 2007,则必须在脚本中使用“xlsx”作为文件扩展名。
[vb]Sub SaveAttachmentsToDisk(Item As Outlook.MailItem) Dim olkFolder As Outlook.MAPIFolder, _ olkAttachment As Outlook.Attachment, _ objFSO As Object, _ strRootFolderPath As String, _ strFilename As String, _ intCount As Integer 'Change the following path to match your environment strRootFolderPath = "z:\www\departments\webreports\" Set objFSO = CreateObject("Scripting.FileSystemObject") Set olkFolder = Application.ActiveExplorer.CurrentFolder If Item.Attachments.Count > 0 Then For Each olkAttachment In Item.Attachments If objFSO.GetExtensionName(LCase(olkAttachment.FileName))=“xls”然后
strFilename = olkAttachment.FileName intCount = 0 Do While True If objFSO.FileExists(strRootFolderPath &strFilename)然后
intCount = intCount + 1 objFSO.deletefile (strRootFolderPath & strFilename) Else Exit Do End If Loop olkAttachment.SaveAsFile strRootFolderPath & strFilename End If Next End If Set objFSO = Nothing Set olkAttachment = Nothing Set olkFolder = Nothing End Sub[/vb]
您将需要确保您具有适当的安全级别设置为了正确处理脚本。 在Outlook中,转到工具>macros>安全。 我select了没有安全检查的macros。 这可能对您的环境造成太大的限制; 如果是这样,请尝试下一个最高设置。
创build一个新的Outlook规则(工具>规则和警报)以反映您的更改。 我的规则查找来自特定电子邮件地址的新邮件,并具有一个附件(我想要移动的Web文件),将邮件移动到特定文件夹(以便我可以备份邮件/附件),然后运行上面的模块/脚本将Web文件移动到适当的samba共享。 这是我的规则说明看起来像:
Apply this rule after the message arrives from [email protected] and which has an attachment and on this machine only move it to the WEBBACKUP folder and run Project1.SaveAttachmentsToDisk
objFSO.deletefile(strRootFolderPath&strFilename)
同
“&olkAttachment.FileName”的strFilename =“Copy(”&intCount&“)