I have following use case:
One day before the refuse collection comes I get a email like this:
Ihr nächster Abfuhrtermin
Sehr geehrte Kund,
wunschgemäß möchten wir Sie an den folgenden Abfuhrtermin erinnern:
…
Restmülltonne:
Freitag, 13.01.2017
Falls Sie diesen Service…
Now I want to react to this Mail and send a notification to a Central Operation Unit (Link). I already send somethink to the operation unit, so this is not my problem… The problem is, how can I react to a incomming mail and scour it for a word like “Restmülltonne” or “Gelber Sack”?
I already try it with IFTTT but somehow it is not working… with the connection to gmail…
Question: Is there a other posibility/binding to react to a gmail? (Instead of IFTTT)
If you run your own mailserver, you could use procmail to react immediately on incoming mails and trigger REST calls to openHAB or push MQTT messages. I think we need to know a bit more about your setup.
I have the mail binding installed and use it to send mails.
But, I don’t see any channels in the thing configuration. Especially no content channel. According to the binding documentation it has to be configured manually? I don’t know how to do this.
With access to the email subject and body (content) it should be possible to trigger a rule.
That looks quite good. Is the mail already marked as “read”? In that case it will not be processed. You could try removing the “read” marker on the mail. If that does not solve the problem:
disable the thing
select “TRACE” logging (Settings/Add-on Settings (right column), click “show all”, select the mail binding)
mark the message as “unread”
enable the thing
check the log the the inbox folder is processed, copy the log
select “DEFAULT” logging (Settings/Add-on Settings (right column), click “show all”, select the mail binding)
You should see log lines like
[DEBUG] Processing `subject` from `sender-address`
then one of
[TRACE] Detected plain text message
[TRACE] Detected MIME message
[TRACE] Detected MIME multipart text message
No. Nevertheless, I tried to remove the “read” marker without success.
The “openhab.log” file shows the following line after Trace enabled:
2024-03-25 17:56:00.143 [DEBUG] [inding.mail.internal.POP3IMAPHandler] - Processing `Ihre Abfuhrtermine` from `"Dr. Harald Pott" <example@example.org>`
2024-03-25 17:56:00.162 [WARN ] [inding.mail.internal.POP3IMAPHandler] - Failed to convert mail content from '"Dr. Harald Pott" <example@example.org>' with subject 'Ihre Abfuhrtermine', to String: class com.sun.mail.imap.IMAPInputStream
2024-03-25 17:56:03.812 [DEBUG] [inding.mail.internal.POP3IMAPHandler] - Processing `Ihre Abfuhrtermine` from `"Dr. Harald Pott" <example@example.org>`
2024-03-25 17:56:03.831 [WARN ] [inding.mail.internal.POP3IMAPHandler] - Failed to convert mail content from '"Dr. Harald Pott" <example@example.org>' with subject 'Ihre Abfuhrtermine', to String: class com.sun.mail.imap.IMAPInputStream
So one of the messages in the second block is not in the log? Please forward the mail, including all headers to github@klug.nrw. I‘ll check why it is not properly processed. Thanks.