JSFiddle - React, Tailwind, and code Playground

HTML

<a href="mailto:[email protected]">Send a e-mail</a>

JavaScript

$(document).on('click', 'a[href^=mailto]', function(e) {
      var checkClose, checkLoaded, event, href, i, len, loadEvents, results, t, wndw;
      e.preventDefault();
      href = this.href;
      wndw = window.open(href, 'mail');
      checkClose = function() {
        console.log('checkClose');
        try {
          wndw.location.href;
          return wndw.close();
        } catch (error) {
          return console.log('webmail');
        }
      };
      t = setTimeout(checkClose, 5000);
      try {
        checkLoaded = function() {
          console.log('loaded');
          clearTimeout(t);
          return t = setTimeout(checkClose, 2000);
        };
        wndw.onload = checkLoaded;
        loadEvents = ["DomContentLoaded", "load", "beforeunload", "unload"];
        results = [];
        for (i = 0, len = loadEvents.length; i < len; i++) {
          event = loadEvents[i];
          results.push(wndw.addEventListener(event, checkLoaded));
        }
        return results;
      } catch (error) {
        return checkLoaded();
      }
    });