[BETA RELEASE] HEmail - Simple Email Notification Device Driver, no RPi needed

So the driver is pretty simplistic - establish a telnet connection and dump what is passed. A thought would be adding some sort of delay or retry and beefing up error trapping.

I have not really messed with the code since I started using Node-RED which has it's own email node that works with everything.


Ah, I think the issue is notifications sent close together. The first one always works, but the 2nd one fails if an email notification is still in progress.

1 Like

Any chance you could add a delay function that waits for say 1 second after the IP email is being sent before sending the next one?

PS, I have no plans to use NR, it's very cool but now I have my head around RM I just dont see a need for it.

So each send is a separate thread I think. Best I can do is introduce a random delay before sending. Will look into..

1 Like


1 Like

Here is my issue. I have an internal Email server (Postfix) running on a linux box. My email notification all go through the postfix and work great as I have the Postfix box relaying to Gmail using a secure connection. So basically I just need this to send and email to my postfix server with only these fields:

  • SMTP Server
  • From Address
  • Port

This postfix server is at my house and behind a firewall. I use it for all notifications within my network. It only sends. All my apps that I have running or servers only require those 3 fields.

How can I make this work? I tried setting the other fields to false, but it still doesn't send.

This is how you setup postfix to relay to Gmail for those interested.


1 Like

That's cool thanks for the link. I am doing exactly the same except I run my own mail server (postfix as well!) in a dmz but that will come in handy I think.

Have you looked at @kahn-hubitat's sendmail? He's been actively developing his version so that might be something to consider.

I am using Node-RED for my rules etc - it has built in email support so I can securely send and notify based on HE events.

1 Like

I'm running a DMZ also. I looked at Kahn's app and it says no local server needed. I'm really looking for something that stays inside and let Postfix securely send the email through Gmail. I really thought this app would work. I think it's close I just don't know code or I'd fix it for my use.

I use sendmail as a relay. And my outgoing email is sent via Gmail - I have a specific Google username just for my Hubitat notification email. I had to decrease account security to get this to work. Specifically, turn on "Less secure app access".

1 Like

Once you do that are you sure it's only turned on just for that one Gmail accoun? Would not want that enabled across regular personal accounts...


Is there any way to use some sort of global/process variable as a type of "lock"?

If it was set, that meant something else was sending--causing other threads to wait until they could get the lock variable?

It wouldn't likely be 100%, unless there is some sort of thread-safe locking in HE to check and set that variable in an atomic process.

Yes, I think there is.. something to look at maybe... mmmm

1 Like

I just added a semaphore lock to the seqSend function. It's on github now. Have not really tested it all that much.

1 Like

I second this idea. My ISP offers non-SSL SMTP but does not support authentication over plaintext.

Can you please remove the requirement of providing a username and password?

I got it working with Sendmail - Send email and text notifications, (notification device) no local server needed

Sure! Let me look into it.

I just added a quick bypass let me know if this works for you...


here are the changes i made recently to get mms working correctly on
AT&t so we could get texts in one thread.. thought you'd want to know..

  def msgData = "${state.EmailBody}"
	        def emlBody = ""
	        def emlSubject = ""
            def emlDateTime = new Date().format('EEE, dd MMM YYYY H:mm:ss Z',location.timeZone)
            def String idP1 = now()
            def String idP2 = java.util.UUID.randomUUID().toString().replaceAll('-', '')
            def String msgId = '<' + idP2 + "." + idP1 + "@2LGKSendmailV2>"
          if(msgData.substring(0,1) == "{") {
		        def slurper = new groovy.json.JsonSlurper()
		        def result = slurper.parseText(msgData)
		        emlBody = result.Body
		        emlSubject = (result.Subject != null ? result.Subject : "")
	        } else {
	           	emlBody = msgData
	        	emlSubject = (Subject != null ? "${Subject}" : "")
              def sndMsg =[
                  "MAIL FROM: <${From}>"
                , "RCPT TO: <${To}>"
        		, "DATA"
                , "From: ${From}"
                , "To: ${To}"
                , "Date: ${emlDateTime}"
                , "Message-ID: ${msgId}"
                , "Subject: ${emlSubject}"  
                , "MIME-Version: 1.0"
                , 'Content-Type: text/plain; charset="us-ascii"'
                , "Content-Transfer-Encoding: quoted-printable\r\n"
                , ""
        		, "${emlBody}"
        		, ""
        		, "."
	        	, "quit"

Wow that looks like it was "fun" to figure out.. thank you.

1 Like

Many hours of hard labor, followed by additional hours of doctor-recommended hot tubbing to restore his health. We were a bit worried, but he pulled through. [phew] :smiley:


ya you can see why 2 of my top apps are like that from all the testing to nail down what was needed during testing.


Download the Hubitat app