Node-red-node-email username and password

Hi @knolleary,
I see that you are a maintainer of this node.

I'm using the node-red-node-email node and all works just great.
The issue I'm having is not being able to set the username and password in a msg.property.
I have tried using msg.userid and msg.password and can't seem to get any further.
I am entering userid and password directly into the node to get it to work, but would like to be able to change them programmatically. I can't find anything about these properties.

I have read and followed all the links from Node Red Email

Any info please?

Thank you for your work in maintaining Node-RED.

Cheers.
Paul.

I think it is not possible to set those via message properties. They are stored encrypted in the credentials file.

1 Like

you can use an env variables (i think)

Try setting env vars EMAIL_USER and EMAIL_PWD (either before launching node-red or as system wide env vars) then use $(EMAIL_USER) and $(EMAIL_PWD) in the config fields.

You can also set environment variables in your settings file:

process.env.EMAIL_USER = "ted";
process.env.EMAIL_PWD = "str0ng_p455w0rd";

Also, since the settings file is node.js code, you could even grab the settings from a file.


The bottom line is: you cannot pass username and password in a message but you can set it at startup of node-red using the above techniques

1 Like

That's a shame.
It means that the end user will have to come back to me when they want to change the account details.
Having also to disclose them to me which they may not want to do.

When they could use a passworded config screen and change the details whenever they want.
I think it I would be better for me as system creator or the end user to decide the appropriate level of security required, rather than a strict system enforced when on occasions it would not be required.

Ho Hum can't have it all my own way.

Cheers.
Paul.

You have options (the beauty of open source).

  • fork the email node & make it work
  • import nodemailer in settings.js & write your own function (or subflow)
  • have the users save the username/password in a json file & permit them to restart node-red

This is off the top of my head.

We don't know the details of the system you are trying to achieve - but maybe you could send the email from a generic account on their behalf. If you start wanting to store emails and passwords you are opening yourself up to GDPR etc etc.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.