Send Mail in Rule Engine (Experimental)

I’m Using the Mail-Action and the Rule-Engine.
Wenn i setup a new rule

Then…(execute a given script)
script: sendMail(“”, “subjecttext”, “messagetext”)

When i run this rule i get this error in the log
[ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: ReferenceError: “sendMail” is not defined in at line number 1

What is the correct syntax in the rule-engine for sending an email with the mail-action

The same happens when i’m using the action BroadcastNotification
sendBroadcastNotification(“text notification”)
Script execution failed: ReferenceError: “sendBroadcastNotification” is not defined in at line number 1

Looks like your mail.cfg is not correctly defined:

# The SMTP server hostname, e.g. ""

# the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS/SSL))

# the username and password if the SMTP server requires authentication

# The email address to use for sending mails

# set to "true", if STARTTLS is enabled (not required) for the connection
# (optional, defaults to false)

# set to "true", if SSL negotiation should occur on connection
# do not use both tls=true and ssl=true
# (optional, defaults to false)

# set to "true", if POP before SMTP (another authentication mechanism)
# should be enabled. Username and Password are taken from the above
# configuration (optional, default to false)

# Character set used to encode message body
# (optional, if not provided platform default is used)

Thx for your response.
I’ve checkt the settings in the mail.cfg again. All parameters seem to be correct.
I think it’s an syntax issue…

This is my “script”

and thats the Errror Message
[ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: ReferenceError: “sendMail” is not defined in at line number 1

Make sure you have


Otherwise I have no ideas, sorry.

I to get the same error. Mail.cfg is correctly set for Gmail and I’m doing a time based rule in the rule engine.
I’m not sure if the rule engine is working correctly. I have not tried creating a rules file and doing it that way.

Has anyone a working mail configuration with a “sendmail” inside the rule configuration?


My working config is already posted above, no issues so far.

In a rule I’m using a simple:

sendMail("", "Test", "This is a test message.")

I am having the same error in the log

[ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: ReferenceError: “sendMail” is not defined in at line number 1

My eMail is still not working, if you found a solution please post how you solve this problem

I checked the mail cfg again

SMTP set for gmail and TLS true and false for SSL.

Read somewhere that you have to change the security for your email acct as well.

But still a no go.

I stopped playing around with that and just created $$.rules file and it’s working fine. Rules don’t show in UI but doesn’t matter to me. Try that as a test and see if your email starts

Can you please upupload a sample of your $$.rules file

Ok let me get home and I will send you copy of it.

Also I used eclipse to get rid of the errors that I was having before.

Ok first install mail action from the UI, then check to ensure you have these set in mail.cfg (look in services folder). I use gmail, sample below:
password=your email password

Here is the rules file, ensure to set your xx.items file as well.

rule “Washer complete"
Item Washer changed from ON to OFF

In your XX.items file, ensure you have the item setup

Switch Washer “Washer” { channel=“network:device:xxx_xxx_xx_xx:online” }

I am still a noob playing around with this, but got it to work. It won’t show up in the UI, but don’t care for it much, so far pleased with the notifications.