Mailer function doesn't fully work in Node.js

A follow up from this post.

What’s not working:

  1. HTML email with template file
    {"status":"500","message":"html.replace is not a function","stack":"TypeError: html.replace is not a function\n...
  2. Static HTML email, triggered from Schedule
    (node:18768) UnhandledPromiseRejectionWarning: TypeError: this.req.get is not a function...
  3. Both Static HTML and HTML email with template file, triggered from Schedule
    2021-02-19 (1)

What’s working so far…:

  1. Text Email (not HTML) every time (both from API and Schedule)
  2. Static HTML email triggered from API step (not Schedule)

Tested on Wappler 3.7.7.

2 Likes

I made part of the code conditional for when run from schedule. When running from schedule we don’t have a request and I can’t retrieve the server address from the request to fix relative paths in the html. So when using html mails with the scheduler you have to make sure to use full urls in your mail template.

Here the updated file, unzip it in lib/modules.

mail.zip (1.3 KB)

1 Like

I’ve updated the file. Still get error.
(node:5144) UnhandledPromiseRejectionWarning: TypeError: this.req.get is not a function

I see the check should be a bit stricter since we have some dummy req object.

mail.zip (1.3 KB)

1 Like
  • Static HTML - Sent
  • HTML with Template - Sent but data bindings didn’t render data e.g. got this {{output_confiq.org}} in the email

Update: also get this error if Embed image option is ticked:
(node:7292) UnhandledPromiseRejectionWarning: TypeError: html.replace is not a function

New update.

mail.zip (1.3 KB)

1 Like

works like a charm

Kudos and thanks much! :+1: :+1:

Fixed in Wappler 3.7.8

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.