0

Working with Redemption Dll version 6.3.0.6164

When I try to send a mail from a program, always appears a popup from Outlook asking for the password. And if i enter the pwd, they ask again, and again, and again ...

Here is the code i use :

    Dim Sessio As Redemption.RDOSession
    Dim Inbox As Redemption.RDOFolder
    Dim Msg As Redemption.RDOMail
    Dim s As String
    Sessio = New Redemption.RDOSession

    Sessio.LogonHostedExchangeMailbox(Mailuser, Mailuser, Pwd)
    Inbox = Sessio.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox)
    Msg = Inbox.Items.Add
    Msg.To = "XXXXX@gmail.com"
    Msg.Body = "Test"
    Msg.SenderEmailType = "EX"
    Msg.Subject = "Test"
    Msg.Save()
    Msg.Send()
    Sessio.Logoff()
    Inbox = Nothing
    Sessio = Nothing
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

1 Answers1

0

Keep in mind that LogonHostedExchangeMailbox assumes Basic auth is enabled on the Exchange server, if it is not, all bets are off.

If Outlook is already running and connected to the mailbox in question, you can piggyback on its session. Use the following instead of LogonHostedExchangeMailbox:

 outlook = New Outlook.Application
 namespace = outlook.GetNamespace("MAPI")
 ns.Logon 'does not do anything if Outlook is already running
 Sessio = New Redemption.RDOSession
 Sessio.MAPIOBJECT = ns.MAPIOBJECT
 Inbox = Sessio.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox)
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Hi. So, we have a problem. Our exchange server is a 365 Office and i need to send messages from a server with the session closed, so there is any other way to do that with Outlook 16 (Office 365) ? – user21371589 Apr 13 '23 at 11:06
  • Do you mean from a machine where Outlook is not installed or is not configured with a profile pointing to the mailbox you are trying to use? – Dmitry Streblechenko Apr 13 '23 at 15:17
  • I mean from a machine where outlook is installed, but is a server where there are some scheduled services running while session is closed and one of this services needs to send an email, so outlook is not running. And the Basic Auth is not avalaible – user21371589 Apr 17 '23 at 07:31
  • If Basic auth is disabled, and you cannot somehow "borrow" an auth token from Outlook, LogonHostedExchangeMailbox won't be able to do anything. – Dmitry Streblechenko Apr 17 '23 at 15:47