Install and Configure EWS (Exchange Web Service) Send Mail

1) Firstly you need to have the following SQL Function in your IQX database:

ALTER FUNCTION "pears"."EmailProviderDetails"()
RETURNS long VARCHAR
BEGIN
  DECLARE rv long VARCHAR;
  DECLARE crlf CHAR(5);
  SET crlf = "char"(13)+"char"(10);
  -- RETURN null;   -- if not using EWS
  SET rv = 'EWS'+crlf; -- mandatory for EWS
SET rv = rv + string(rv,(SELECT (SELECT staff.Email  || '; ' FROM staff WHERE Staff.staffid =  UserStaffID ) || list(NUMBER,';' ORDER BY pt.name ASC) FROM Phone AS p KEY JOIN PhoneType AS pt WHERE p.WhoID = UserStaffID AND p.Who = 'U' AND pt.Capabilities = 'E'),crlf);  -- one or more sender addresses separated by ;  Use userstaffid to look up valid ones for logged in user.
  --    set rv=rv+'IQXEWSSendMail.exe'+crlf;   -- the program to call (with full path if not either in system path or iqx.exe folder). Notepad.exe handy for testing.
  SET rv = rv+'IQEWSSendMail.exe'+crlf; -- the program to call (with full path if not either in system path or iqx.exe folder). Notepad.exe handy for testing.
 
  -- All remaining lines are inserted into the <ServerDetails> block.
  SET rv = rv+'<ExchangeServerUrl>https://pcname.domain.co.uk/EWS/Exchange.asmx</ExchangeServerUrl>'+crlf; -- Example: https://TITANIC.iqx.co.uk/EWS/Exchange.asmx
  SET rv = rv+'<ExchangeVersion>2010</ExchangeVersion>'+crlf;  -- You need to specify the version of Exchange you are using.
  SET rv = rv+'<ExchangeServicePack></ExchangeServicePack>'+crlf; -- Add the Exchange Service pack 1 or 2 or 3 etc. blank if none.
  RETURN rv
END

2) Add the following files to your IQX main program folder.

        1) IQXEWS.exe
        2) Microsoft.Exchange.WebServices.dll
        3) IQXEWS.pfx

3) Add the following records to your IQX database.

Firstly create the record below in the “phonetype” table.

INSERT INTO "pears"."phonetype" ("sortorder","company","contact","applicant","phonetypeid","name","Capabilities","AuditFlag","displaygroup","displayname","SocialMediaType") VALUES(999,0,0,0,'UUSE','Email','E',1,0,'EWS Email',NULL)

For each email address you want to add you need one of these insert statements. phoneid is unique and therefore has to change for each record. phonetypeid matches the phonetypeid above. Who is given 'U' so not to mess with any other types. “number” becomes the email address to add.

INSERT INTO "pears"."phone" ("phoneid","phonetypeid","who","whoid","number","numberdigits") VALUES('XX01251426042013026F','UUSE','U','XX18141218042013016A','EWS@pulse.com',NULL)

Error Reporting

Any error that occurs is written to the *.err file. This file can be found in the same folder as the files above

  • sa37-00.txt
  • Last modified: 2017/12/01 16:35
  • (external edit)