Configure email in OpenHAB (gmx.de)

To be able to send emails from rules you need to configure the sendMail action.

I explain this here based on the German email service gmx.de. First you need to go to your openHAB configuration in /etc/openhab2/services.

openhab2 service configuration

Here you create a text file with the name mail.cfg. In this file you configure your email account information.
For gmx.de it looks like this:


################## Mail Action configuration
mail:hostname=mail.gmx.net
mail:port=465
mail:username=myMail@gmx.de
mail:password=myPassword
mail:from=myMail@gmx.de
#mail:tls=true
mail:ssl=true

You need to replace „myMail@gmx.de“ with your email address and „myPassword“ with your password. Than its done and you can use the sendMail command in your rules.

A simple sendMail command has the following format:


sendMail("myMail@gmx.de", "subject text", "email text")

You can also send attachments. For more details look here.