为什么 Attachments.Count 在传入的带有附件的邮件中返回 0? [英] Why does Attachments.Count return 0 on incoming mail with attachments?

查看:21
本文介绍了为什么 Attachments.Count 在传入的带有附件的邮件中返回 0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 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:	emp"
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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆