@naiv/mta
v0.0.5
Published
Pure NodeJS Mail Transfer Agent
Downloads
46
Readme
NAIV Mail Transfer Agent
Mail Transfer Agent in pure NodeJS with no dependency.
Usage Example
import { createAttachmentFromUri, EmailParams, sendEmail } from "@naiv/mta";
import fs from 'fs';
async function main() {
const privateKey = fs.readFileSync('./dkim_private.pem', 'utf8');
const param: EmailParams = {
from: "[email protected]",
to: ["[email protected]"],
subject: "Last Meeting Notes (5)",
text: "This is our last meeting notes, please read all our deals for tomorrow events, dont miss any details. Regards",
html: "<div><b>This</b> is our last <i>meeting notes</i>, please read all our deals for tomorrow events, dont miss any details. <u>Regards</u></div>",
attachments: [await createAttachmentFromUri('./meeting-notes.txt')],
dkimOptions: {
domain: "org.naiv.dev",
selector: "graf",
privateKey
}
};
return await sendEmail(param);
}
main().then(console.log).catch(console.error).finally(() => process.exit(0));