Examples for MailControl Binding

Hi there,
are there any examples how I can use the MailControl Binding? The wiki page is a bit sparse on info. Do I use it e.g. with a string item? Do I need to setup a rule to pass the values to an Item?
Thanks in advance.

Cheers.

I am struggling with this binding as well. I have copied the config lines from WIKI page to the openhab.cfg. Edited values for my service account on gmail. When I send email to this service account, nothing is recorded in openhab logs. Can you post a working example of email body an Item configuration from Items file?
Do I need to do anything more than enabling pop3 in gmail settings?

Hello.

is the mailcontroll on openhab running? Could you tell me an example for the mail format?

thanks

+1 for better info on the binding

Hi @watou, do you know if the configuration parameters of mailcontrol are to be added to the openhab.cfg file (for all other bindings I’ve used there is a section in the file for them, but there is none for mailcontrol)?

Thanks,

Federico

Here is the wiki page.

I also see this in the source code:

    private static final String USERNAME_PROPERTY = "username";
    private static final String PASSWORD_PROPERTY = "password";

    private static final String SMTPHOST_PROPERTY = "smtphost";
    private static final String SMTPPORT_PROPERTY = "smtpport";
    private static final String SMTPAUTH_PROPERTY = "smtpauth";
    private static final String SMTPSTARTTLS_PROPERTY = "smtpstarttls";
    private static final String SMTPSOCKETFACTORYCLASS_PROPERTY = "smtpsocketfactoryclass";
    private static final String SMTPSOCKETFACTORYPORT_PROPERTY = "smtpsocketfactoryport";

    private static final String POP3HOST_PROPERTY = "pop3host";
    private static final String POP3PORT_PROPERTY = "pop3port";
    private static final String POP3SOCKETFACTORYCLASS_PROPERTY = "pop3socketfactoryclass";
    private static final String POP3SOCKETFACTORYPORT_PROPERTY = "pop3socketfactoryport";

Thanks, I had already looked at the wiki, but the binding is not working for me. I installed the binding using apt-get. Added the configuration parameters to openhab.cfg, as per the wiki. The logs show:

12:18:46.485 [DEBUG] [o.o.b.m.i.MailControlActivator:33   ] - MailControl binding has been started.
12:18:58.893 [INFO ] [.service.AbstractActiveService:169  ] - MailControl Refresh Service has been started

But I’m unable to control items via email:

my email looks like this (raw):

Subject: OpenHAB
Message-Id: <xxxx>
X-Universally-Unique-Identifier: xxx
Date: Wed, 2 Mar 2016 12:18:58 +0100
To: theaddressconfiguredinopenhabcfg
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))

{"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":=
"0","command":{"commandType":"ON_OFF","value":"OFF"},"item_id":"Test_light"},"senderEmail=E2=80=9D:=E2=80=9Dsenderaddress"}=

The logs show nothing else than the two lines above.

Did you install the dependent jar files like access-email…jar and mail-…jar? Just a hint, because I didn’t tested the binding myself so far.

@daveZ Good point. It would be good if this requirement were removed!

@federic0 I see a JSON syntax error in your email "timeSent":="0"

I also see a bug in the binding code where it’s supposed to default poll at 1 minute, but unless you specify mailcontrol:refresh=60000 in openhab.cfg, it tries to poll every six seconds. But without dependent JARs the bundle may not run properly.

…but it looks like the dependent JARs are already provided in the bundle.

Thanks @watou and @daveZ, will look into that (btw what is the syntax error? it’s a copy/paste from the wiki). My main point is that the binding info is confusing, how do I know if the dependent jar files are installed or not, should they be in openhab/addons?

I have these files installed:

/var/lib/openhab/workspace/org.eclipse.osgi/bundles/225/1/.cp/lib/access-email-1.0.2.jar
/var/lib/openhab/workspace/org.eclipse.osgi/bundles/225/1/.cp/lib/mail-1.4.jar
/var/lib/openhab/workspace/org.eclipse.osgi/bundles/225/1/.cp/lib/json-simple-1.1.jar
/var/lib/openhab/workspace/org.eclipse.osgi/bundles/225/1/.cp/lib/activation-1.1.jar
/var/lib/openhab/workspace/org.eclipse.osgi/bundles/225/1/.cp/lib/openhab-mailcontrol-model-1.1.0.jar

The above is not valid JSON.

You are right, the equal sign is produced by the mail client, it’s a soft break (it’s the raw message).

This is how the message appears on the client:

I have tried sending the messages as plain text and also with gmail’s web interface.

Hello,
I have tried to get this binding to work with no luck.

Anyone had a breakthrough, I would need to parse the title of an incoming email from gmail and trigger actions accordingly.
I thought it would be easy :).

The binding documentation is quite limited

Any help is appreciated.
Thank you

You should’ve started a new thread for this instead of tagging onto the end of 4-year-dead thread.

Noted thank you