为什么带有附件的传入邮件的Attachments.Count返回0? [英] Why does Attachments.Count return 0 on incoming mail with attachments?
问题描述
我正在尝试使用Outlook 2010将附件自动保存到本地文件夹.
I'm trying to save attachments automatically to a local folder using Outlook 2010.
当我第一次创建规则并将其应用到所有收件箱时,它会起作用.不适用于传入邮件(未保存任何文件).
It works when I first create the rule and apply it to all inbox. It doesn't work with incoming mail (no file was saved).
我尝试添加一些奇怪的代码,并引发了错误,因此脚本得以运行.
I tried adding some weird code and it fired errors so the script ran.
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\temp"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd Hmm ")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Next
End Sub
似乎Outlook无法识别传入邮件的附件.我尝试添加"MsgBox MyMail.Attachments.Count",结果返回0.
It seems that Outlook doesn't recognize the attachment for incoming mail. I tried adding "MsgBox MyMail.Attachments.Count" and it returned 0.
推荐答案
我终于找到了原因.如果要自动保存附件,似乎无法使用IMAP.我切换到POP3,一切正常.
I finally found out the reason. It seems that using IMAP is not an option if I want to save attachments automatically. I switched to POP3 and everything works just fine.
这篇关于为什么带有附件的传入邮件的Attachments.Count返回0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!