feat: Implement smtp connection

This commit is contained in:
Faruk AYDIN
2022-10-23 14:35:29 +02:00
committed by Ali BARIN
parent d816446c5e
commit 3978e8cd0d
6 changed files with 263 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { IGlobalVariable } from '@automatisch/types';
import nodemailer, { TransportOptions } from 'nodemailer';
const verifyCredentials = async ($: IGlobalVariable) => {
const client = nodemailer.createTransport({
host: $.auth.data.host,
port: $.auth.data.port,
secure: $.auth.data.useTls,
auth: {
user: $.auth.data.username,
pass: $.auth.data.password,
},
} as TransportOptions);
await client.verify();
await $.auth.set({
screenName: $.auth.data.username,
});
};
export default verifyCredentials;