Failed to resolve recipient in Redemption?

  • Thread starter Thread starter Bingo
  • Start date Start date
B

Bingo

On my custom form, I create a new mail item and send it
to myself during the Item_Send event. I got the
following error and the code failed when I tried to send
it out. Since I saved the email in the draft folder,
when I opened the email, I can see that it took a few
seconds for Outlook to resolve the recipient name/my
name. Any recommendations? Thanks.

Error message:
An exception of type 'Redemption.SafeMailItem: Could not
resolve the message recipients' was not handled


VBScript code:


Dim oNsp ' Outlook Namespace
Dim oMail ' Outlook Mail Item
Dim oRdpMailItem ' Redemption Safe Mail Item
Dim oRdpRecipients ' Redemption Safe Mail Recipients
Dim oRdpRecipient ' Redemption Safe Mail recipient
Dim sMailID ' Outlook Mail Item Entry ID
Dim lTotal ' Total Number of Recipients
Dim lCnt ' Recipient Counter


Function Item_Send()

' Only process outgoing emails using the custom form

' Outlook Namespace
Set oNsp = Item.Session

' Clone a mail off Item
Set oMail = Item.Copy
' To save the new mail to avoid overwriting
oMail.Save
sMailID = oMail.EntryID

' Recycle object
Set oMail = Nothing
Set oMail = oNsp.GetItemFromID(sMailID)

' Redemption Safe Mail Item
Set oRdpMailItem = CreateObject
("Redemption.SafeMailItem")
oRdpMailItem.Item = oMail

Set oRdpRecipients = oRdpMailItem.Recipients

' Remove all recipients
lTotal = oRdpMailItem.Recipients.Count
For lCnt = lTotal To 1 Step -1
oRdpMailItem.Recipients.Remove lCnt
Next

' Add my Mailbox as the only recipient
oRdpMailItem.Recipients.Add "Bingo"
' oRdpMailItem.Recipients.ResolveAll

' Send out the new mail
oRdpMailItem.Send

' Cleanup
Set oRdpMailItem = Nothing
Set oRdpRecipients = Nothing
Set oRdpRecipient = Nothing
Set oNsp = Nothing
Set oMail = Nothing
End Function
 
Always check for .Resolved = True for any recipients you add. Also, "Bingo"
might not be resolvable. Is that your EX alias? Try using the full mailbox
name or Exchange alias. If all else fails for a test try using your explicit
SMTP address.
 
Ken,

Bingo is a real alias. I also tried the full mailbox
instead. Both failed. I'm going to try .Resolved = True
and let you know if that is the solution. Thanks!
 
I checked the return for .Resolved method. It failed 9
out of 10 times but it did succeed once for a while with
no code changes. It's really odd.
 
I even tried to keep resolving the name for 30 seconds
but it still failed. What can I do?
 
Try manually putting in the SMTP address for your alias and see if that
works. Also try the SafeRecipients.AddEx method and see if that works any
better. And make sure you're using the latest version of Redemption.
 
The alias works fine when I manually put entered it.

I changed the sequence now to remove and add recipients
directly on the Outlook MailItem and then pass it to
Redemption SafeMailItem. It's working with this switch.
Now sure why I cannot do this directly on the redemption
SafeMailItem.

I'm going to try the AddEx method though. Thanks.
 
Back
Top