Outlook with Redemption: adding attachment


BJX

Joined
Apr 28, 2009
Messages
1
Reaction score
0
Hello,

(My first post here ever!)

My application sends mail via Outlook using Redemption. Works great with all versions of Outlook, most of the time. However, on one specific computer, a puzzling error comes up when sending a message with an attachment.

The error message is as follows:

Error! -21417852 - Error in IAttach.OpenProperty(PR_ATTACH_DATA_BIN: RPC_E_FAULT
This error is most likely caused by setting RDOSession.MAPIOBJECT to Namespace.MAPIOBJECT
from OOM when Outlook is running in a separate process.
Try to call RDOSession.Logon instead to make sure an in-proc IMAPISession is used.
I have no idea what's causing the problem. My code seems to work most of the time. Any ideas?

Here are the computer details:

Windows XP
OL2003 SP2 using POP/SMTP for email.
The Redemption "helper" Add-In is not used and is disabled.
The code is in an Access module.

Here's my code:


Code:
    'Get Mail Item
    Set xNS = xOutlook.Session
    Set xFolder = xNS.GetDefaultFolder(4) '4 = olFolderOutbox
    Set xOLMailItem = xFolder.Items.Add '0 = olMailItem
    Set xMail = CreateObject("Redemption.SafeMailItem")
    xMail.Item = xOLMailItem
  
    'populate message
    xMail.To = xsEmailAddress
    xMail.Subject = msSubject
    'xMail.BodyFormat=2 '2=olFormatHTML	'not necessary, and doesn't play well with OL2000
    xMail.HTMLBody = xstream.ReadAll
    xstream.Close
  
    'add attachments (from array of file names)
    For Each xv In marrAttachReports
        xMail.attachments.Add CStr(xv) '<-- ERROR OCCURS HERE! ***********
    Next
     
  'send
    xMail.SEND
     
    'redemption cleanup & force delivery
    Set xOLMailItem = Nothing
    Set xMail = Nothing
    Set xMapiUtils = CreateObject("Redemption.MAPIUtils")
    xMapiUtils.DeliverNow
    xMapiUtils.Cleanup
    Set xMapiUtils = Nothing
     On Error Resume Next 'I think this errors out in OL2000
    xNS.syncobjects.Item(1).Start
    If Err.Number <> 0 Then Err.Clear
    On Error GoTo Err
 
Last edited:
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top