easyEws Updated to 1.0.20

This was more than a patch this time. It was a minor update to two functions:

  • sendMailItem
  • sendPlainTextEmailWithAttachment

There was an issue reported (#12) where the sendMailItem function was not working in IE11. This was because it was created to take an inline object (ES6). Well on IE11 (which only supports ES5), it broke.

So, I fixed sendMailItem to support ES5 and also took the opportunity to add two often requested features of this function:

  • It will now allow you to submit HTML body content or Text. It will also parse the HTML for you if you submit it as is.
  • It will also now allow you to send both file attachment (new), and mail item attachments (original).

Please see the documentation for more information on the updates to this function: https://github.com/davecra/easyEWS#sendMailItem

Also I updated the sendPlainTextEmailWithAttachment function. Under the covers this uses the sendMailItem function. So I had to update it to use the new format so it would work as well. There was no change to it’s features/functionality however.

I did not get to the last item I have had requests for:

  • ability to specify recipients as To/CC/BCC. I will update this at some future date. Also, please let me know if you would like to see this.

Overall, the goal is to have the sendMailItem() function be a full multi-purpose function at some point. It is almost there, but please keep the suggestions coming.

2 thoughts on “easyEws Updated to 1.0.20

  1. Hi, I am trying to understand what I’m doing wrong (I have VSTO experience, but new to Office.JS and JavaScript).

    Here is my code and the result from the debugger:
    var itemId = Office.context.mailbox.item.itemId;
    if (itemId == undefined) utils.showHtmlDialog(“Cannot connect to Mail Item.”, “Error”);
    $.getScript(“https://cdn.jsdelivr.net/gh/davecra/easyEws/easyEws.js”, function () {
    easyEws.getMailItem(itemId,
    function (result) {
    if (result) emailItem = result;
    console.log(`item: ${JSON.stringify(emailItem)}`);
    console.log(`Success: ${JSON.stringify(result)}`);
    },
    function (error) { console.log(`Error: ${error}`); },
    function (debug) { console.log(`Debug: ${debug}`); }
    );
    });

    item: {“value”:{“location”:null}} /_Assorted/OutlookAddin/SaveEmail/SaveEmail.js:46:33
    Success: {“value”:{“location”:null}} /_Assorted/OutlookAddin/SaveEmail/SaveEmail.js:47:33
    Debug: STATUS: succeeded
    —- START SOAP —-
    Default true
    —- END SOAP —-
    —- START RESPONSE —-
    NoErrorR E D A C T E DTest SubjectNormal<html><head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><style type=”text/css” style=”display:none;”> P {margin-top:0;margin-bottom:0;} </style></head><body dir=”ltr”><div style=”font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);”><span style=”color: rgb(12, 100, 192);”>Test </span><span style=”color: rgb(118, 62, 155);”>Body</span><br></div></body></html>368172020-12-15T14:19:34Z2020-12-15T14:19:35ZfalsefalseSasha Abramovsabramov@artsvision.netSMTPMailboxfalsefalseSasha Abramovsabramov@artsvision.netSMTPMailboxfalse
    —- END RESPONSE —-

Leave a Reply to David E. Craig Cancel reply