本文介绍了Outlook无法识别一个或多个名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下vba代码,它读取一个邮箱,并向发送无效代码的任何用户作为回复发送回邮件,但有时会收到运行时错误(Outlook不识别一个或多个名称)。我的问题是,

I have following vba code which reads a mailbox and sends reply to any users who send a invalid code as a reply to the mailbox, but sometimes the run time error (Outlook does not recognize one or more names) is received. My questions are,


  1. 将创建新的MAPI配置文件解决问题,或者我需要添加一个解决地址的代码,并忽略电子邮件ID不再存在。如果是,我该怎么做?

  2. 一般来说,特定条件下不发送电子邮件的参数是什么?

以下是我们当前拥有的代码:

Below is the code that we currently have:

      Sub ResponseCodeError(Item As Outlook.MailItem)
      'If not a valid code then send email to the User
      If (Left(Item.Subject, 2) <> "S;" And Left(Item.Subject, 2) <> "N;") Then
      Dim outobj, mailobj
      Set outobj = CreateObject("Outlook.Application")
      Set mailobj = outobj.CreateItem(0)
      With mailobj
     .To = Item.SenderEmailAddress
     .Subject = "Invalid Code"
     .Body = "Please use a valid CODE"
     .Send
      End With
     'Move Email to Error Folder
     mailboxNameString = "mailboxname"
     FolderName = "Error"

     Dim olApp As New Outlook.Application
     Dim olNameSpace As Outlook.NameSpace
     Dim olCurrExplorer As Outlook.Explorer
     Dim olCurrSelection As Outlook.Selection
     Dim olDestFolder As Outlook.MAPIFolder

     Set olNameSpace = olApp.GetNamespace("MAPI")
     Set olCurrExplorer = olApp.ActiveExplorer
     Set olCurrSelection = olCurrExplorer.Selection
     Set olDestFolder = olNameSpace.Folders(mailboxNameString).Folders(FolderName)

     Item.Move olDestFolder

     End If

     Set outobj = Nothing
     Set mailobj = Nothing
     End Sub


推荐答案

我曾经遇到过同样的错误,我在代码中搜索过5个小时后就像疯狂的搜索一样解决了这个错误。但是这更简单:1个电子邮件地址在域名中缺少。(点)。

I had once the same error, and I resolved it after 5 hours searching like crazy in the code. But it was much simpler: 1 email address had an error missing the .(dot) in the domain name.

这篇关于Outlook无法识别一个或多个名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 10:23