• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1627
  • Last Modified:

How do I use the Redemption with MAPI installed to send email?

I would like some help on how to use this function. I keep getting the following error messages [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]] Which indicate that the user failed to log into the server.

We have spent too much time,Can anyone help?
Would really, really appreciate it.

Some Description:

We are trying to impersonate the main account (which has sufficient access to the other exchange servers email accounts) to give the ability to send as these accounts.

Note: The ExchangeMapiCdo.exe is installed and Redemption has been registered.
The account is the Domain and User account.

the identity inpersonation in the web.config is as follow:

    <authentication mode="Windows"/>
    <identity impersonate="true" userName="DomainName\UserAccount" password="PSW"/>    

the following code in the web service is:

        Dim objSession As Object
            Dim ExchangeServer As String = String.Empty
            Dim objREDSession As New Redemption.RDOSession
            Dim bstrProfileInfo As String = String.Empty
            Dim SafeItem As Object

            objREDSession.LogonExchangeMailbox("UserAccount", "ServerName")<<<<<<<<< It is failing on this.

            SafeItem = objREDSession.GetDefaultFolder(9).Items.Add
  • 4
  • 3
1 Solution
Éric MoreauSenior .Net ConsultantCommented:
RDO is not the prefered method of sending emails in .Net.

Check http://emoreau.com/Entries/Articles/2007/09/Using-SystemNetMail.aspx
newbie_girlAuthor Commented:
Thank you for the response and I am taking your suggestion on board.  We have requested from our Service Provider to install and configure the outlook on the test server. I will let you know as soon as everything has been implemented and tested.

Would be appreciate if there is there another suggestion to concede.
Éric MoreauSenior .Net ConsultantCommented:
>> We have requested from our Service Provider to install and configure the outlook on the test server

It is not Outlook that you need on the server, you need a SMTP server.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

newbie_girlAuthor Commented:

I have used the following code and published to the test environment which does not have outlook installed. Microsoft.Office.Interop.Outlook.dll is attached to the service.
The IIS 7.0 - SMTP E-mail for the service been configured to look at the exchange server.

        Dim strRecipient As String = "my email"
        strSubject = "Test"
        strBody = "Test Test"
        Dim dtStartDate As Date = Date.Now
        Dim intReminder As Object = Nothing
        Dim intDuration As Object = Nothing

        Dim ObjApplication As New Outlook.Application
        Dim ObjNamespace As Outlook.NameSpace
        Dim objFolder As Outlook.MAPIFolder
        Dim ObjRecipient As Outlook.Recipient
        Dim ObjApplicationt As Outlook.AppointmentItem
        Dim apptDate As Date
        Dim strContact As String
        ObjApplication = CreateObject("Outlook.Application")
        ObjNamespace = ObjApplication.GetNamespace("MAPI")

        ObjRecipient = ObjNamespace.CreateRecipient(strRecipient)
        objFolder = ObjNamespace.GetSharedDefaultFolder(ObjRecipient, olFolderCalendar)
        If Not objFolder Is Nothing Then
            ObjApplicationt = objFolder.Items.Add
            If Not ObjApplicationt Is Nothing Then
                With ObjApplicationt
                    .strSubject = strSubject
                    .strBody = strBody
                    .Start = dtStartDate
                    If Not (intReminder Is Nothing) Then
                        .ReminderSet = True
                        .intReminderBeforeStart = intReminder
                    End If
                    If Not (intDuration Is Nothing) Then
                        .intDuration = intDuration
                        .intDuration = 10
                    End If
                End With
            End If
        End If

        ObjApplication = Nothing
        ObjNamespace = Nothing
        objFolder = Nothing
        ObjRecipient = Nothing
        ObjApplicationt = Nothing

the error:

System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at EmailCalendarService.Service1.SendMeetingRequestWithImpersonation(String strOffice, String strConta...).

Please advise.
Éric MoreauSenior .Net ConsultantCommented:
You haven't taken that from my code for sure. why don't you just use System.Net.Mail?
newbie_girlAuthor Commented:

Apology for late response

Thank you for your suggestion. However we are trying to send the meeting request directly to the user without attaching it to an email.
Different users should perform the above functionality concurrently from the same and different accounts.

Our tests until now are as follow:
•      Using the outlook object is forcing the outlook application open and close each time the meeting request is preformed. It may throw MAPI error for the request if one request has not preformed or closed properly. We are still performing tests on this. Any suggestion will be helpful.
•      Using redemption and impersonation is giving us good results when concurrent request have been performed from the same account. However, error will be thrown when the request performed concurrently from different account.
•      Using redemption and identity impersonation (web.config) fails on the exchange logon function.

Please advise.
newbie_girlAuthor Commented:

Thank you for your help. We have followed your advice (System.Net.Mail) and we have done load testing and the outcomes were rally good.
Refer to the following link for the code.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now