Email Endpoint with array in payload by NodeRed

Hello @jaimebs

I’ve tried ways to view a table in the Email endpoint but no success.

Is it possible to enter an array in the Email endpoint node (NodeRed) to show a table in the email body?

Payload: [{"bucket":"dados_aaaa","device":"aaaa","last_ts":"11:31:56 - 09/09"},{"bucket":"dados_bbbb","device":"bbbb","last_ts":"11:34:28 - 09/09"},{"bucket":"dados_cccc","device":"cccc","last_ts":"11:35:27 - 09/09"}]

Code:

<div style="width=100%; height:100%; overflow-y:scroll">
    <table class="table table-striped">
      <thead>
        <tr>
          <th>Bucket</th>
          <th>Device</th>
          <th>Data_Hora</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="entry in value">
            <td>{{entry.bucket}}</td>
            <td>{{entry.device}}</td>
            <td>{{entry.last_ts}}</td>
        </tr>
      </tbody>
    </table>
</div>

Email Endpoint:

Email Received:

I’m trying to insert the JSON(Payload) data from your example (below) into a table:

Could the email endpoint accept an HTML ‘body/payload’ (with the template node) via NodeRED?
Would it be possible to attach images? Or would it be better to encode Images in base64 or via link?

Hi,

I am not sure if the endpoint email body accepts the AngularJS commands.

For this (building the dynamic email body) I would use the node red, sending the email directly from node red without using the email endpoint.

Hope this helps.

1 Like

As @ega states, the endpoint email body does no currently accept Angular directives, and the only way to send a formatted email would be to use an external node or service capable of handling this issue.

Nevertheless, we will analyze the issue and try to include some kind of solution in future releases.

1 Like

Thanks for the sugestion @jaimebs and @ega

I’ve googled and seen that there are Amazon SES and SNS nodes available in the NodeRED repository, but I haven’t tested it yet.
Amazon SES:
node-red-contrib-aws-ses-send 0.11
node-red-contrib-aws-ses 0.1
Amazon SNS:
node-red-contrib-aws 0.7

Hi,

Also you may use an external SMTP service, calling from node red, it not necessarily must be the instance’s mail service.

Hope this helps.