blob: 21accd09d0df0d1c506f5a0a81a92b7c2b271405 (
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
|
import * as MailDev from 'maildev'
function mockSmtpServer (emailsCollection: object[]) {
const maildev = new MailDev({
ip: '127.0.0.1',
smtp: 1025,
disableWeb: true,
silent: true
})
maildev.on('new', email => emailsCollection.push(email))
return new Promise((res, rej) => {
maildev.listen(err => {
if (err) return rej(err)
return res()
})
})
}
// ---------------------------------------------------------------------------
export {
mockSmtpServer
}
|