preview-email
Advanced tools
Comparing version 3.0.15 to 3.0.16
11
index.js
@@ -41,2 +41,3 @@ const childProcess = require('child_process'); | ||
simpleParser: {}, | ||
hasDownloadOriginalButton: true, | ||
...options | ||
@@ -51,10 +52,12 @@ }; | ||
raw = message; | ||
base64 = message.toString('base64'); | ||
if (options.hasDownloadOriginalButton) base64 = message.toString('base64'); | ||
} else if (typeof message === 'string') { | ||
raw = message; | ||
base64 = Buffer.from(message).toString('base64'); | ||
if (options.hasDownloadOriginalButton) | ||
base64 = Buffer.from(message).toString('base64'); | ||
} else if (typeof message === 'object') { | ||
const response = await transport.sendMail(message); | ||
raw = response.message; | ||
base64 = Buffer.from(response.message).toString('base64'); | ||
if (options.hasDownloadOriginalButton) | ||
base64 = Buffer.from(response.message).toString('base64'); | ||
} else { | ||
@@ -65,3 +68,3 @@ throw new TypeError('Message argument is required'); | ||
const parsed = await simpleParser(raw, options.simpleParser); | ||
parsed.base64 = base64; | ||
if (options.hasDownloadOriginalButton) parsed.base64 = base64; | ||
@@ -68,0 +71,0 @@ const html = await renderFilePromise( |
{ | ||
"name": "preview-email", | ||
"description": "Automatically opens your browser and iOS Simulator to preview Node.js email messages sent with Nodemailer. Made for Forward Email and Lad!", | ||
"version": "3.0.15", | ||
"version": "3.0.16", | ||
"author": "Forward Email (https://forwardemail.net)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -136,2 +136,3 @@ # preview-email | ||
* `returnHTML` (Boolean) - whether or not to return HTML only – and subsequently not write nor open the file preview file (defaults to `false`) | ||
* `hasDownloadOriginalButton` (Boolean) - whether or not to render a "Download Original" button to download via base64 inline onclick JavaScript (defaults to `true`) | ||
@@ -138,0 +139,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22366
222
165