From c75da6ea3b71a528091d46ee033e834f0f7dd504 Mon Sep 17 00:00:00 2001 From: cohitre Date: Mon, 4 Mar 2024 20:07:14 -0800 Subject: [PATCH] Adding nodemailer sample --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93f920c..f0f75ae 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,24 @@ In most cases, you'll want to take the EmailBuilder.js configuration, render it ### Sending through nodemailer -Coming soon +```javascript +import { renderHtmlDocument } from '@usewaypoint/email-builder'; +import nodemailer from "nodemailer"; + +// Replace this with your transport configuration +const transportConfig = {} +const transporter = nodemailer.createTransport(transportConfig); + +// Replace this with the JSON for your Reader document +const CONFIGURATION: TReaderDocument = {} + +await transporter.sendMail({ + from: 'no-reply@example.com' + to: 'friend@example.com', + subject: 'Hello', + html: renderHtmlDocument(CONFIGURATION, 'root'), +}); +```
@@ -175,6 +192,7 @@ await axios({ }, data: { + from: 'no-reply@example.com' to: 'friend@example.com', subject: 'Hello', bodyHtml: renderHtmlDocument(CONFIGURATION, 'root'),