Vb.net知道我发了邮件

问题描述 投票:0回答:0

我是新人,没有太多经验。我有一个问题(至少对我来说)。 我应该检查我是否真的发送了一封电子邮件,这有效。但我注意到,如果我在 outlook 的已发送文件夹中有很多电子邮件,它会产生错误。 对我来说,搜索白天发送的电子邮件就足够了。

       Fldr = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail)
        i = 1

        For Each oMsg In Fldr.Items()
             'ecnf is a  string
            If oMsg.HTMLBody.Contains(ecnf) Then GoTo 003 Else GoTo 001

001:

        Next
        MsgBox(“Email non ok”)
        GoTo 002

003:

        i = i + 1
        If oMsg.HTMLBody.Contains(ecnf) = True Then
            inv = False
            MsgBox(“Email ok”)
            GoTo 002
            'Else
            'GoTo 001
        End If

002:
 
       'other irrelevant code

这是它产生的错误。

enter image description here

如果我将上个月的电子邮件移至较新的电子邮件,那么循环将完美运行,否则会产生错误

vb.net
© www.soinside.com 2019 - 2024. All rights reserved.