Trying to use Mail Action in OH2


I want to use the Action Mail Addon in Openhab2. I copied the org.openhab.action.mail-1.7.1.jar found here to openhab2-master/git/openhab2/addons. It doesn’t show up in my Eclipse IDE, is this correct?

Then I copied and renamed the openhab.cfg to a new folder openhab2-master/git/openhab2/conf/services as told here. The folder conf and services didn’t exist. I also searched for a similar location. For my windows PC it is: C:\openhab2-master\git\openhab2\distribution\src\assemble\resources\addons\conf\services and ubuntu: openhab2-master/git/openhab2/distribution/openhabhome/conf/services. I also changed the content of the openhab.cfg to the following:

# The SMTP server hostname, e.g. ""
# The email address to use for sending mails

When I want to call the sendMail function via sendMail(", “TEST”, “TEST”); it says the method sendMail(String, String, String) is undefined for the type MyHandler.

What else do I need to configure?

This does not make sense. You have to either copy the jar to your distribution (not the source checkout from git) or to import the sources into your workspace in the IDE.

@Kai I don’t understand your answer. Do I have to create a New Java Project in eclipse and import the extracted jar files? Or did I copied the jar to the wrong location? Or is there a specific location in eclipse where I have to import it? I’m a bit confused right now, because the distribution folder is located in the git folder.

For me it seems like that these location could be the right ones:

  • for the openhab.cfg : openhab2-master/git/openhab2/distribution/src/assemble/resources/addons/conf/services
  • for the org.openhab.action.mail-1.7.1.jar : openhab2-master/git/openhab2/distribution/src/assemble/resources/addons

Because in the file openhab2-master/git/openhab2/distribution/src/assemble/addons.xml there is the following:


I still can’t use the sendMail(). What else am I missing to do?

When I am talking about the “distribution”, I mean the binary, which is ready to run: