有没有办法检测Outlook邮件是否没有附件?

有没有办法检测Outlook邮件是否没有附件?,outlook,Outlook,我一直在寻找解决这个问题的方法,现在需要一些帮助 我需要检测是否有人在outlook帐户没有附件时向我发送邮件 我的情况是这样的 我收到了一封电子邮件 该主题中有特定的文本 它有一个附件 如果有附件,则发送回复1并将邮件移动到文件夹A 如果没有附件,它会发送reply 2.0并将邮件移动到文件夹B中 欢迎任何帮助 非常感谢您可以在VBScript中轻松完成此操作,如下所示: Private Sub Application_ItemSend(ByVal Item As Object, Cancel

我一直在寻找解决这个问题的方法,现在需要一些帮助

我需要检测是否有人在outlook帐户没有附件时向我发送邮件

我的情况是这样的

我收到了一封电子邮件 该主题中有特定的文本 它有一个附件 如果有附件,则发送回复1并将邮件移动到文件夹A 如果没有附件,它会发送reply 2.0并将邮件移动到文件夹B中

欢迎任何帮助


非常感谢

您可以在VBScript中轻松完成此操作,如下所示:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim m As Variant
Dim strBody As String
Dim intIn As Long
Dim intAttachCount As Integer, intStandardAttachCount As Integer

On Error GoTo handleError

'Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
intStandardAttachCount = 0

strBody = LCase(Item.Body)

intIn = InStr(1, strBody, "original message")

If intIn = 0 Then intIn = Len(strBody)

intIn = InStr(1, Left(strBody, intIn), "attach")

intAttachCount = Item.Attachments.Count

If intIn > 0 And intAttachCount <= intStandardAttachCount Then

    m = MsgBox("It appears that you mean to send an attachment," & vbCrLf & "but there is no attachment to this message." & vbCrLf & vbCrLf & "Do you still want to send?", vbQuestion + vbYesNo + vbMsgBoxSetForeground)

    If m = vbNo Then Cancel = True

End If

handleError:

If Err.Number <> 0 Then
    MsgBox "Outlook Attachment Reminder Error: " & Err.Description, vbExclamation, "Outlook Attachment Reminder Error"
End If

End Sub
私有子应用程序\u ItemSend(ByVal项作为对象,取消作为布尔值)
Dim作为变体
像弦一样暗的链子
暗淡如长
Dim intAttachCount为整数,intStandardAttachCount为整数
关于错误转到handleError
'如果您的电子邮件上有包含图像或其他文件的签名,请编辑以下行。使intStandardAttachCount等于签名中的文件数。
intStandardAttachCount=0
strBody=LCase(项目正文)
intIn=InStr(1,字库,“原始信息”)
如果intIn=0,则intIn=Len(strBody)
intIn=仪表(1,左侧(底座,intIn),“连接”)
intAttachCount=Item.Attachments.Count
如果intIn>0且intAttachCount