The ExchangeConnector28 is developed by Marco Kuipers of 28 IT Pty Ltd and is provided 'As is'.

It contains a test project, view and the .net dll that connects to your Exchange server or Office 365 exchange.

1. Use the test project to test your Exchange server and connection

1.1. Copy the files to your DataFlex workspace

1.2. Register the DLL

As this is a .net DLL you use regasm instead of regsvr32.

The version of .net runtime you have on your machine might be slightly different, so the directory would be different (just use the highest version number).
  1. Run CMD as administrator (vista or later)
  2. Change directory (cd) to the programs directory where you copied the files
  3. Register the DLL like \windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe ExchangeConnector28.dll

Should respond with


   Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
   Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

   Types registered successfully

1.3. Compile and run the ExchangeEmailTester.exe

Type in your username and password.

Leave the Exchange Server Endpoint for office 365, or change it to your exchange domain like https://mail.mydomain.com/EWS/Exchange.asmx.

Alternatively use the Discover function with the prompt button.

(F5 in the fields places back the Office 365 endpoint)

Type in the recipient, the subject and the body and sent the email.

In this demo version it will add the following to the email body.


GRANT OF LICENSE TO USE. 
This agreement grants you the following rights. * DEMO VERSION You may install and use an unlimited number of copies of the product
on an unlimited number of machines.
The demo version expressly prohibits you from using the product for any purpose other than evaluation of the functionality of the
product. You may not use the demo version to develop completed applications. 

2. Build your own email sender

I suggest you have a look at the ExchangeEmailTester.vw and make your changes to suit your needs.

The package uses Structs and byref, meaning it needs DataFlex 11 or up. However for older DataFlex versions like VDF 7 or DF3.2 you can use the command line ExchCon28.exe for email sending.

The struct passed to the DLL with the function SendEmail is of the format:

Struct tExchangeConnectorEmail
    String username
    String password
    String serviceEndpoint
    String replyTo
    String[] recipients
    String[] recipientsCC
    String[] recipientsBCC
    String subject
    String body
    String[] attachmentFiles
End_Struct
  

3. Build your own meeting request

Again I suggest you have a look at the ExchangeEmailTester.vw and make your changes to suit your needs. The Meeting request is a tab page in the same view.

The struct passed to the DLL with the Function CreateMeetingRequest is of the format:

Struct tExchangeConnectorMeeting
    String username
    String password
    String serviceEndpoint
    String[] requiredAttendees
    String[] optionalAttendees
    String subject
    String location
    Integer startYear
    Integer startMonth
    Integer startDay
    Integer startHour
    Integer startMinute
    Integer endYear
    Integer endMonth
    Integer endDay
    Integer endHour
    Integer endMinute
    String body
    String[] attachmentFiles
    Integer isAllDayEvent
End_Struct

4. Using the command line interface for sending emails

The command line interface is provided to support VDF7 and DF3.2 projects. It is using the DLL so it will still need to be registered as per above section 1.2.

When run without arguments the following help is shown

Calls ExchangeConnector28 with arguments and text file with email content.

ExchConn28 /U:Username /P:Password /S:SrvcEP /E:EmailFile /O:OutputFileStatus

  /U    Username; leave blank when using domain user to on-premise Exchange
  /P    Password; leave blank when using domain user to on-premise Exchange
  /S    ServiceEndpoint;
        e.g. Office 365 'https://outlook.office365.com/EWS/Exchange.asmx'
        e.g. on-Premise 'https://computername.domain.contoso.com/EWS/Exchange.asmx'
  /E    Filename of email text file. The text file can contain:
        ReplyTo: Johnny@abc.com
        To: Jo@abc.com
        To: Mo@abc.com
        CC:
        BCC:
        Subject: This is a very cool email that I wanted you to see
        Attachment: c:  empttachment1.jpg
        Attachment: c:  empttachment2.jpg
        Body: This is the email text. It is just html.
        And the text can continue for many lines, as the body is the last tag.
        You can bold etc.
  /O    Filename of output text file, the status will be saved here.
  

Sample 1 email text file

ReplyTo: Johnny@abc.com
To: Jo@abc.com
To: Mo@abc.com
CC:
BCC:
Subject: This is a very cool email that I wanted you to see
Attachment: c:\temp\attachment1.jpg
Attachment: c:\temp\attachment2.jpg
Body: This is the email text. It is just html and should be rendered into the string.
But continue reading and adding to the Body variable until the end of file is reached.
Further to the above, the CC: can be left blank or can be left out all together. When blank leave the struct member null

Sample 2 email text file

ReplyTo: Johnny@abc.com
To: Jo@abc.com
CC: John1@abc.com
CC: John2@abc.com
CC: John3@abc.com
Subject: This is a very cool email that I wanted you to see
Body: Hi
This is a cool email from me.

Sample 3 email text file

To: Jo@abc.com
Subject: This is about the minimum that an email would look like I'd think.
Body: Hi
This is an email with a unicode smiley 😀.

If you have any questions or suggestions email me on Marco@28IT.com.au or post in the forum DataAccess Forum Post

If you would like to use this in your project, please contact me to purchase a version of the DLL without the demo text.