I’m getting crazy in trying to simply send a mail.
The email binding doesn’t work with some error message. Then I thought “hey with sendgrid I can also send a mail via a http request - easy”. But also that sendHttpPostRequest doesn’t work.
This is my rule:
rule "Presence"
when
Item SWITCH_PRESENCE changed
then
val content = '{"personalizations": [{"to": [{"email": "me@mail.xyz"}]}],"from": {"email": "me@mail.xyz"},"subject": "Philipp changed","content": [{"type": "text/plain", "value": "presence changed"}]}'
val headers = newHashMap("Authorization" -> "Bearer SomeBearerToken")
sendHttpPostRequest("https://api.sendgrid.com/v3/mail/send", "application/json", content, headers, 3000)
end
This fails with this error message:
2020-04-07 21:00:38.327 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Presence': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.HTTP.sendHttpPostRequest(java.lang.String,java.lang.String,java.lang.String,int) on instance: null
This really drives me crazy. I’m struggeling with a simple mail send for hours now. Any ideas why it doesn’t work?
The code is exactly like in the documentation: https://www.openhab.org/docs/configuration/actions.html#http-actions