Giter VIP home page Giter VIP logo

forwardemail / test-preview-emails-cross-browsers-ios-simulator-nodejs-javascript Goto Github PK

View Code? Open in Web Editor NEW
206.0 4.0 22.0 1.39 MB

Automatically opens your browser and iOS Simulator to preview Node.js email messages sent with Nodemailer. Made for @forwardemail and @ladjs. Cross-browser and cross-platform email testing.

Home Page: https://forwardemail.net/docs/test-preview-email-rendering-browsers-ios-simulator

License: MIT License

JavaScript 71.44% Pug 27.49% Shell 1.07%
preview email letter opener previewer emails node pug render demo

test-preview-emails-cross-browsers-ios-simulator-nodejs-javascript's Issues

What's the reasoning behind adding google analytics in the template?

I've just discovered these lines in your email template:
https://github.com/niftylettuce/preview-email/blob/337f7f1007801a2691f427856a861808f7cbab62/template.pug#L169-L172

While I understand that you might be interested in gaining insights about the usage of this package, I feel that this is somewhat inappropriate in this context.
Even in a dev environment sensitive information might be displayed. And adding a third party script without an obvious disclaimer seems like a bad practice.

[fix] Links in previews don't open on click

Describe the bug

Node.js version: v16.18.1

OS version: Fedora release 38 (Thirty Eight)

Description: Links in previews don't open on click. Is this an intentional security feature?

Actual behavior

Click on links in the email preview do not open after update from 3.0.10 to 3.0.17 (I assume due to ce6d443sandbox attribute).

Console error message, e.g. in chrome:

Blocked opening '<redacted>' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

I can still work around this via "Open link in new tab" in the context menu (proving the link works in principle).

Expected behavior

Click on links in the email preview opens in new tab.

If no general safe solution can be found, maybe make the attribute value configurable by the (library) user.

Code to reproduce

file:///tmp/3aa0abe6-c509-4f8d-a359-a110c2facf8e.html opened in browser, rendering HTML preview of message incl.

…
<a href="http://localhost:3000/<redacted>" target="">Sign In</a>

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Pugjs Uglifyjs dependency issues (Webpack)

node_modules/pug-filters/lib/run-filter.js 23:25-40
Critical dependency: the request of a dependency is an expression
node_modules/pug-filters/node_modules/uglify-js/tools/node.js 24:11-32
Critical dependency: the request of a dependency is an expression

The result of email rendering is within <iframe> tage

Hi, I am using this preview-email to test if my template.pug display properly. When it render my template.pug in the message, everything from my template.pug is wrapped inside the <iframe>, and the font in the head was also in the iframe and not reflected in my email content. Can you have a look at it?

Styles overridden

It seems the styles in my HTML emails are being overridden by those of preview-email. Am I missing something?

Thanks for the great project!

Problem with WSL path

I am using this package through email-templates in a WSL environment. It opens chrome for the WSL as explained here, but it does not open the html generated file.

I specified a path like /mnt/c/... for dir option so both windows and WSL can access. It writes the html correctly, but does not load the page in chrome.

I think it is due to chrome on windows that does not understand WSL formatted path, I tested replacing this by:

if (options.open) await open(filePath.replace('/mnt/c', 'C:').replace('/', '\\'), options.open);

and it worked as expected (but it is not reliable at all).

I don't know if it is really an issue with this package or if it should be supported... Maybe just adding an option that takes a function to transform path to give to open could do the job at a minimal cost.

Support other template engines (handlebars, ejs...)

I'm using email-templates with hbs and I wonder if the preview package can support something else than pug?

Maybe override the default render function by one passed in options:

  options = {
    dir: os.tmpdir(),
    id: uuid.v4(),
    open: { wait: false },
    template: templateFilePath,
    renderFn: pug.renderFile,
    ...options
  };

....

  const html = await pify(options.renderFn)(
    options.template,
    Object.assign(options.locals, {
      cache: true,
      pretty: true,
      dayjs
    })
  );

[fix] Define mailparser dependency with ~ instead of ^

Describe the bug

Node.js version: 14

OS version: macOS 12.6.1

Description: mailparser lib doesn't properly follow semver and has caused a breaking change in a minor/patch release.

Actual behavior

When running an application that depends upon preview-email, using node 14, the following error occurs:

./node_modules/mailparser/node_modules/html-to-text/lib/html-to-text.cjs:1838
    tableToString: (rows) => tableToString(rows, formatOptions.rowSpacing ?? 0, formatOptions.colSpacing ?? 3),
                                                                           ^
SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/mailparser/lib/mail-parser.js:12:24)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/mailparser/index.js:3:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/preview-email/index.js:19:26)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/email-templates/lib/index.js:29:22)

Expected behavior

Expected to run without errors.

Code to fix

Update package.json with

    "mailparser": "~3.3.0",

or

    "mailparser": "~3.5.0",

Since 3.5.0 is the latest version that doesn't have breaking changes.

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
    No I have not done this because the issue is with Node 14.

[fix] preview-email is failing due to require('node:child_process') is not getting processed on mac intel

Describe the bug

Node.js version: 14.17.3

OS version: mac os 10.15.3

Description: require('node:child_process') throwing error

Actual behavior

Cannot find module 'node:child_process'

Expected behavior

preview-email should load properly

Code to reproduce

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Browser doesn't open in WSL

I've tried several parameters for the app property both none worked.

Here's what I've tried:

  1. /c/Program Files (x86)/Google/Chrome/Application/chrome.exe (Nothing happens, I have a custom mounting for docker that's why I don't have the /mnt/ prefix)
  2. explorer.exe (Just opens a new Windows Explorer window)
  3. powershell.exe -c (Nothing happens)
  4. wsl-open (Nothing happens)

Allow to configure the opn command

Hi, thank you for this great package.

I am working on Linux with visual code and recently upgraded from 1.27 to 1.28, after this upgrade the emails where not opened in the browser any more, but a window of visual code was opened.

I have found that it is because the text/html mime type was opened by default by visual code after the upgrade.
Before upgrade :

$ xdg-mime query default text/html
firefox.desktop
``
After upgrade : 

$ xdg-mime query default text/html
code-url-handler.desktop
``
I know it is not an issue with the email-preview package, but I wanted to expose the context because the xdg commands is used by opn.

So my need would be to have the opening command configurable so I can ask to specifically open firefox or google chrome.

Thank you very much.

Mailparser update

So it looks like a few hours ago nodemailer/mailparser reverted 3.0.1 back to MIT (yay!). And this version has the vulnerability fixed packages as well.

Dependency package of display-notification version 2.0.0 having vulnerability (Versions of the package semver before 7.5.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range)

Describe the bug

Node.js version: 18.16.1

OS version: Windows 10

Description: Dependency package of display-notification version 2.0.0 having vulnerability. Latest version of display-notification having fix. Link https://security.snyk.io/vuln/SNYK-JS-SEMVER-3247795

Actual behavior

Expected behavior

Code to reproduce

Checklist

  • [ *] I have searched through GitHub issues for similar issues.

  • [ *] I have completely read through the README and documentation.

  • [ *] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Doesn't show on Ubuntu?

Hi,
first of all great work! We are using your email-templates module and the preview shows on every system except Ubuntu using Chrome.
Is that just us or a general issue?
All the best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.