1 import MailDev from '@peertube/maildev'
5 private static instance: MockSMTPServer
6 private started = false
8 private emails: object[]
10 collectEmails (port: number, emailsCollection: object[]) {
11 return new Promise<number>((res, rej) => {
12 this.emails = emailsCollection
18 this.maildev = new MailDev({
25 this.maildev.on('new', email => {
26 this.emails.push(email)
29 this.maildev.listen(err => {
30 if (err) return rej(err)
40 if (!this.maildev) return
45 MockSMTPServer.instance = null
48 static get Instance () {
49 return this.instance || (this.instance = new this())
53 // ---------------------------------------------------------------------------