blob: 40ae37d70bfca1561c77c6a0873daeff314f612f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
const MailDev = require('maildev')
// must run maildev as forked ChildProcess
// failed instantiation stops main process with exit code 0
process.on('message', (msg) => {
if (msg.start) {
const maildev = new MailDev({
ip: '127.0.0.1',
smtp: 1025,
disableWeb: true,
silent: true
})
maildev.on('new', email => {
process.send({ email })
})
maildev.listen(err => {
if (err) {
// cannot send as Error object
return process.send({ err: err.message })
}
return process.send({ err: null })
})
}
})
|