Openedge 11.7.2 Integration with Outlook .Net APi

Posted by bernhardkraml on 05-Jun-2018 03:31

Hello,

maybe I can find help in this forum.

I have to  send emails with our Progress-Application.

The emails have to be sent with outlook (no SMTP on the client--workstations allowed).

I found some examples for simple emails with attachments but I have 2 more requirements:

1. I have to use another mail-address (In Outlook, we have additional Mailboxes configured, when composing a new mail, there is an additional Field above the recipients ("Send mail as")

2. some users have request read-notification enabled. for mails out of the progress-application we would like to send the emails without notification request.

I found the Microsoft Interop API (Microsoft.Office.Interop.Outlook) but I don't get the gap between the c# examples and Progress for the outlook .net API. I'm just not experienced enough in "how to use .net with progress"

Maybe you can point me into the right direction, pointers to examples and also to the right parts in the OpenEdge Documentations are very welcome.

-bernhard

All Replies

Posted by j.kattestaart on 05-Jun-2018 03:49

use the .net mail libraries

USING System.Net.Mail.*

client = NEW SmtpClient(.....)

see .net docs/stackoverflow for examples to send mail to outlook

Posted by bernhardkraml on 05-Jun-2018 04:26

But with System.Net.Mail.SmtpClient ()- wouldn't this use SMTP?

I'm not allowed to use SMTP . I have to use Outlook!

-bernhard

Posted by j.kattestaart on 05-Jun-2018 04:48

Is it O365?, then you can use smtp (smtp.office365.com).

otherwise the old way is OLE-automation, must be in knowledge base somewhere.

Con: is only for 32-bit

An escape would be to  make a visualstudio solution to call the interop and call this dll from Progress.

Personally i have a simple localhost ASP.NET website which i call from progress

Sometimes (?)it is easier to do stuff in .NET which is complicated in Progress.

BTW: db updates are more simple in Progress....

Posted by bronco on 05-Jun-2018 07:44

Well, you said you weren't allowed to use SMTP from the client. How about from the (App-)Server?

Posted by bernhardkraml on 05-Jun-2018 08:51

App-Server can be allowed.

We have an Outlook-Solution in place at the moment, with an older version of outlook, with something I think is called CDO.

All this on an old Terminalserver.

CDO dosn't work with current Outlook-Version.

My user like the "feature" that they have on copy of the emails in "Sent Items".

Thanks @tpavlovic, I will look into www.dimastr.com/.../home.htm

-bernhard

Posted by marian.edu on 05-Jun-2018 09:18

What exactly do you mean by this statement?


"The emails have to be sent with outlook (no SMTP on the client--workstations allowed)."

SMTP is not something that need to be installed or anything, it's just a protocol that might very well be used by Outlook depending on how the email account is setup there. If you need to talk to Office365 or an on-premises Exchange server then you can also use Microsoft.Exchange.WebServices.
  

Marian Edu

Acorn IT 
+40 740 036 212


Posted by bernhardkraml on 05-Jun-2018 09:26

Sorry for not being clear in this point:

SMTP is only the protocol, so nothing is to be installed.

But our Exchange-Servers don't allow SMTP-Connections from workstation.

Also all Connections with SMTP to Servers on the Internet are blocked.

I think in reality are the SMTP-Ports blocked.

-bernhard

Posted by scott_auge on 05-Jun-2018 09:36

Then to do what is needed is to set up a mail server in house that will act as a "secondary" - it's sole purpose is to transport mail but not store it and only allowed to receive from inside your network. etc.  

Then have the Progress application interact with that secondary which will then forward stuff up to the primary mail server.  The primary will be SMTP ready because that is what the general internet uses.

If they want a "Sent Mail" then they need to open up SMTP for internal connections or hook your app into a microsoft DLL to use exchange.

Work arounds will become confusing and will get muddled up sooner or later on the next update.

Write down what you did!  

Posted by bernhardkraml on 05-Jun-2018 10:04

No mailserver with SMTP allowed in the intranet - i don't know if this is an useful security-measure, but its an worldwide company policy.

So I can't setup a secondary..

At the moment I use this code (extracted from my testprogram):

DEFINE VARIABLE objOutlook AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE objOutlookMsg AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE objOutlookAttach AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE objOutlookRecip AS COM-HANDLE NO-UNDO.

CREATE "Outlook.Application" objOutlook.

objoutlookMsg = objOutlook:CreateItem(0).

objOutlookRecip = objOutlookMsg:Recipients:Add("User@test.com").

objOutlookRecip:Type = 1.

objOutlookMsg:Subject = "TEST Progress".

objOutlookMsg:Body = "The Body".

objoutlookMsg:ReadReceiptRequested = FALSE.

objoutlookMsg:OriginatorDeliveryReportRequested = FALSE.

objoutlookMsg:SentOnBehalfOfName = "AppMAIL@company.com".

objOutlookMsg:Attachments:Add("C:\SomeAtteachment.xls").

objOutlookRecip:Resolve.

objOutlookMsg:Send.

RELEASE OBJECT objOutlook.

RELEASE OBJECT objOutlookMsg.

RELEASE OBJECT objOutlookRecip.

This thread is closed