Email Notifications Driver using Node/sendmail on a PI

A quick thought - it's the return from the post call so likely doesnt mean anything. Will fix in the log call - bypass error log if 'ok' or somesuch.

Updated the driver to bypass if error message = "OK".. Also updated my HE firmware and everything is still working as expected.

Sweet. I will take a look later today. Thanks a bunch!!

I just added a systemd service example in ../DoNetStuff/misc. Figure you'd probably already done that but wanted to let you/interested people know anyhow.

Actually, I was trying to use forever in rc.local but that wasn't working. I also was not able to get it running using your SystemD service. it seems to only run if I start it locally with "node app.js". Any ideas about why that might be the case?
If i run npm run start in the folder, I get an error stating "missing script: start".

There is an updated package.json where the "start" is declared!

Grrr...hold on, let me git-clone again. :slight_smile:

Update: Yup, that worked. THANKS!

Also, I have set up a second device emailing myPhoneNumer@vtext.com This gets around the 10 text limit imposed by HE and still gives your text message notifications. :smiley:

Awesome!!

A nice thing about using sendmail is that it will retry on internet failure for a predetermined time like 24 hrs or so (whatevers in the config). So you should still get alerts regardless even if they are delayed a bit.

Am thinking about where to go with this in the future - stuff like simple Harmony hub activity "switches" or other things.. that's why I named it "DoNetStuff". :grin:

Could also build a controller app following @cobra's lead.. depends upon how much time I really want to spend on all this.

1 Like

Well, feel free to reach out if you need any alpha or beta testing. I'm experienced enough to know what you're talking about but novice enough to still find the problems and not automatically correct them like an expert would. :slight_smile:

Every since I installed the email client on my RPi, it keeps locking up on me. I'm going to remove it and see if it goes away. Do you know of anything else that would interfere with this?

Sorry out of town.. I have not experienced that issue. will look into.

Email client? Did you mean sendmail? You only need sendmail + node stuff nothing else as far as I know. Also did not install a desktop with my PI - just raspian-lite. Still chugging away on my end - though I haven't had a ton of messages yet.

Oh, I'm using my RPi for a LOT of stuff ATM. This particular one is running Cast-Web-API for my Google home's, MotionEye for my cameras, WebIOPi to control the IR light on one camera, and amazon dash for a couple dash buttons I have as backups. It was running perfectly till I added sendmail and your node.js app. I can't imagine it is a resources thing. The CPU usage is still only 27%. Maybe it's a NODE thing. What version of node were you using with this?

My version of node is v11.2.0.

I am only running Apache (currently defunct WC & HousePanel) & Node on that device. I have a few other PIs that handle things like a VPN etc. Otherwise I virtualize everything else.

I do have Google Home assistant as well as an Amazon Echo or two so may look into Cast-Web-API. You might want to see if you can run this on a different box if you have one.

The code itself as you've seen is really simple but maybe the Nodemailer module has some funkiness or somehow there is a conflict/saturation thing going on since cpu does not appear to be affected.

Did you check the status via "systemctl status DoNetStuff" and "journalctl -xe"?

Also make sure you don't have the app running twice? Maybe the old rc.d startup stuff is working somehow?

No, I didn't cause I can't even ssh into the thing. I have another running Hue-emulator. Im going to try moving it to that.
I'm also running node v8.11 due to the Casts-web limitation. So that might be it. Thanks!

I can no longer get sendmail to work with Raspbian Buster. Does it have to be sendmail or can it be some other function? I'm about to throw the thing out a window here in a minute. I have been trying to get it working all day. It keeps failing saying Deferred: Temporary AUTH failure. For some reason it is using the email address I am trying to send the message to to log into the server instead of the one I specified in my authinfo.

That's weird.. I'm using sendmail package for NodeJS.. but it could be replaced with something else. Maybe something that handles authentication etc. I can look into it. Also I switched to a VM after my PI went wonky - we had some power outages, my ups fritzed out and the sd card got corrupted.

Maybe something like NodeMailer.

I don't know if it has to do with the fact that for Time Warner (now Spectrum) my email ends in rr.com but the mail server is mail.twc.com. It keeps giving me an authorization error when trying to send a test email from the command line. I'm wiping it out and trying again now. But this is REALLY frustrating.