Skip to content

Instantly share code, notes, and snippets.

@yoannmoinet
Last active November 21, 2017 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoannmoinet/9e9a57d0cb48f2b1acffc83886602068 to your computer and use it in GitHub Desktop.
Save yoannmoinet/9e9a57d0cb48f2b1acffc83886602068 to your computer and use it in GitHub Desktop.
Unhandled send mails.
import unhandled from 'electron-unhandled';
import mailgunInitializer from 'mailgun-js';
import { APP_VERSION, MAILGUN_PRIVATE, MAILGUN_SERVER } from './config';
const mailgun = mailgunInitializer(({
apiKey: MAILGUN_PRIVATE,
domain: MAILGUN_SERVER
}));
unhandled({
logger: (error) => {
const data = {
from: 'Fenêtre App <no-reply@fenêt.re>',
to: 'support@fenêt.re',
subject: '[ERROR] in Fenêtre !',
html: ` <h1>Version: ${APP_VERSION}</h1>
<h3>${new Date().toLocaleString()}</h3>
<p>The following error occured :</p>
<pre>${error.stack}</pre>`
};
mailgun.messages().send(data, (err) => { /* Handle errors */ });
},
showDialog: !IS_PRODUCTION
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment