‘Promise’ is undefined #IE11
Javascript promises are a key feature of modern asyncronous javascript, but, if you’re developing a mass-market website, cross-browser support may trump the syntactical sugar, especially if you’re facing down business-types, rather than other developers.
Specifically, IE11 does not support Javascript promises, and if you are looking to support a wide range of browsers, then there is a polyfill available from Taylor Hakes, that can get round that error message, that simply says “‘Promise’ is undefined” in IE11
So, working with an example from SMTPJS v3 – which now uses promises, and arrow functions, you need include the following script tags;
https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js
https://smtpjs.com/v3/smtp.js
Then adjust the code to use an inline function instead of an arrow function:
Email.send({
Host : “email-smtp.eu-west-1.amazonaws.com”,
Username : “******”,
Password : “*****”,
To : ‘them@gmail.com’,
From : “you@website.com”,
Subject : “This is the subject”,
Body : “My useragent is ” + navigator.userAgent
}).then(
function(message) { alert(message) } // FOR IE
);