Email Notifications Driver using Node/sendmail on a PI

I'm a Linux convert, but, this is so true! :grinning:

S.

Just updated the repo.. I moved authorization(user/pwd) to a file called "eml_config.js" on the node server (see example file on repo). I tested it with Google/Sendmail (from my VM not PI) and my locally hosted SMTP server.

Getting the following error when I run app.js and trying to use smtps.

TypeError: Cannot read property 'authuser' of undefined

Did you set up the eml_config.js ? I renamed it to eml_config.js.example and gitignored my "real" one. Did not want to give the world my passwords. :laughing:

(I almost committed it to the repo..)

Also note: you have to edit the file and put in as many or as few accounts as you want. Add what you are going to use for the "From" field in preferences in HE as the key and then the auth user/pwd for your email login. From & authuser could be the same.

Then in HE make sure you use the proper "From" user - I added a state variable that returns a list of valid From users (yeah, it's incorrectly named authusers for now).

I wish I could find a way of populating an options list so I could have a dropdown list instead of freeform entry for the "From" in the driver preferences.

Yeah....that state variable is not being returned to HE I don't think. I believe that I populated it correctly.

Something like this:

module.exports = {
    "someemail@email.com": {authuser: "auth1@email.com", authpwd: "password1"}
    ,"someotheremail@email.com": {authuser: "auth2@email.com", authpwd: "password2"}
    ,"yetanotheremail@email.com": {authuser: "auth3@email.com", authpwd: "password3"}  };

Note: There is an extra end bracket at the end (it wouldnt show on a newline for some reason). Also "someemail@email.com" and "auth1@email.com" could be the same. Using the former as an index to reference during the HE webcall.

Yeah, that's the way I have it set up.

Mmm not sure then.. should be called "eml_config.js" and live in the same dir as the app.js.. another silly question, you restarted your Node instance?

It's really just a standard node include.. for giggles my Node version is 12.7.0

Also maybe try running "npm install" again in the main (app.js) dir.. It's working for me. Maybe I will try and configure a PI and see what happens.

So the answer is in your Driver preferences the "From" section must match the key in the "eml_config.js" - in my example above if you wanted to send things out via "auth1@email.com" you would put "someemail@email.com" in the From field.

I got the exact error you did when changing the From field to some other value that did not match the key..

Just updated the code & driver to add a more graceful handling of the situation where the From field does not match any entries in eml_config.js. Also changed state var "authusers" to "StoredFromAddrs".

For simple sendmail you don't need eml_config to have valid entries of course - the file still needs to exist tho.

So, From has to match the Auth User....okay. That was not what I understood from what you had in the js file. It seemed like that should match the first field....not the authuser. I will try again.

I'm not sure what you are saying.. the very first bit is the index.. that is what goes in the From field in HE,

...
"someemail@email.com": {authuser: "auth1@email.com", authpwd: "password1"}
...

"someemail@email.com" goes in the "From" field in the preferences in the HE driver - The quotes are important they need to be left in I think.

I'm trying to simplify things and keep everything in the HE driver but as you pointed out it's not very secure so I decided to move the auth part out and just use the "From" field as a reference.

So part of the confusion is likely the format of the config file ALL quotes in the example must be left in...

On the HE driver side, no quotes necessary.

I did leave the quotes in. The problem is that you are trying to describe all this. A screenshot of the driver with an accompanying .js file is the only way I am going to understand what you're talking about. Even if the example won't work, at least when I'll know what has to go where.

How am I supposed to understand that?!?!

Here ya go.. this is the google entry but the sendmail and smtp (587) all work as well. Just sent a "testing" note to myself.

Wait a second....you're just playing with me right? With everything blacked out, how can I tell what goes where?!? LMAO
I meant set up the driver with your dummy file. Even if it doesn't work I would know what goes where.

Does your from have to match your authuser?

I often use a non existent "from users" so I know what device or service initiated the an email. The auth user and auth password however need to be legit.

Ha! Sorry get too literal sometimes.. that blacked out entry is actually the same as my gmail though it does not have to be maybe it depends on what your ISP will allow. Otherwise the sample file is exactly the same except someemail@email.com goes in the From box. Hope that helps... :wink:

On my server I can have a different From user no issue - I use "hubitat@...". For this setup you do have to put a From user in HE I think - dunno havent really tested that.

Never mind. I'm obviously not smart enough to get this working. I'll find another solution. Thanks for your help.