@athenna/mail
Version:
The Athenna email handler. Built on top of nodemailer.
26 lines (25 loc) • 712 B
JavaScript
/**
* @athenna/mail
*
* (c) João Lenon <lenon@athenna.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { SmtpServerImpl } from '#src';
import { ServiceProvider } from '@athenna/ioc';
export class SmtpServerProvider extends ServiceProvider {
register() {
this.container.singleton('Athenna/Core/SmtpServer', new SmtpServerImpl());
}
async shutdown() {
const SmtpServer = this.container.use('Athenna/Core/SmtpServer');
if (!SmtpServer) {
return;
}
if (!SmtpServer.isListening) {
return;
}
await SmtpServer.close();
}
}