0

I get the error

Outlook does not recognize one or more names.

I believe this is due to the contact appearing multiple times.

For example when I import my contact list, I use the agent number to find the agent.
When I type 11005 and check names, it will have two or more entries of the same person.

Any way I can error handle this?

.Recipient.Add( oldProducerCode)
.Recipient.ResolveAll
.CC = ""
.BCC = ""
.Subject = "Renewal (URGENT)"
.HTMLBody = strHTML
.SentOnBehalfOfName = "Client_Service@automated.ca"
.Send
Community
  • 1
  • 1
  • Which line do you get the error? Also, if the same person has 2 or more entries, how would you know which one to select? It would also be helpful if you provide more of your code as we have no idea how you got to this stage – Zac Jul 23 '20 at 14:16

2 Answers2

0

Ans: If you are using Outlook activities then Outlook application should be installed in that machine and also it should be online at the time

Thanks

  • 2
    I agree that outlook should be installed but if OP is getting recipient error, that indicates that outlook is installed otherwise OP would get an error when trying to initialise outlook application. Also, outlook doesn't has to be open. You can check if outlook is open and if it isn't you can open it via code – Zac Jul 23 '20 at 14:13
0

It seems Outlook can't recognize the name set to the MailItem.SentOnBehalfOfName property.

You can try to call NameSpace.CreateRecipient (returns Recipient object). Then call Recipient.Resolve which returns false if the name cannot be resolved.

The SentOnBehalfOfName property makes sense only in case of Exchange profiles/accounts. Moreover, you need to have the required permissions to send on behalf of another person. See Issue with SentOnBehalfOfName for a similar discussion.

In case if you have multiple accounts configured in the profile you can use the SendUsingAccount property which allows to an Account object that represents the account under which the MailItem is to be sent.

     Sub SendUsingAccount() 
      Dim oAccount As Outlook.account 
      For Each oAccount In Application.Session.Accounts 
       If oAccount.AccountType = olPop3 Then 
        Dim oMail As Outlook.MailItem 
        Set oMail = Application.CreateItem(olMailItem) 
        oMail.Subject = "Sent using POP3 Account" 
        oMail.Recipients.Add ("someone@example.com") 
        oMail.Recipients.ResolveAll 
        oMail.SendUsingAccount = oAccount 
        oMail.Send 
       End If 
      Next 
     End Sub 
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45