Last active
November 21, 2017 17:56
-
-
Save yoannmoinet/9e9a57d0cb48f2b1acffc83886602068 to your computer and use it in GitHub Desktop.
Unhandled send mails.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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