Not able to use sendMail in 1.7.1

Hello all,

I have read and tried the other solutions for this error message,

Error during the execution of rule ‘send email’: The name ‘sendMail(,,)’ cannot be resolved to an item or type.

I have tried every combination of configuration settings with no luck. including port 25 & 587 with TLS both on and off these are my current settings… Can someone please verify these are correct for gmail? is there other configuration or rules I’m missing?

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

Thanks for any help you can give… Dave

Have you got the mail action bundle in your \addons directory?

Hey Ben,

I have these 2 bundles which seen to be related to mail “org.openhab.binding.mailcontrol-1.7.1.jar” and “org.openhab.action.mail-1.7.1.jar”

Are both required ? or just “org.openhab.action.mail-1.7.1.jar”? assuming this is the mail action bundle you’re talking about.

Are there any other prerequisites?

Thanks for the reply Dave

Just org.openhab.action.mail-1.7.1.jar is what’s needed for “sendMail” to work.
There is also no need for any imports in your rule.

Maybe a restart is required? Or did you resolve the issue?

I reinstalled openHAB and the addon’s and working now. Thanks for the info in the imports. Is what cases are these required?

Thanks Dave

Honestly, I don’t even know when they are required. I heard that some very common ones are imported automatically, but something like Joda time, I think, require an explicit import. First I add all imports that I can think of, and then I remove them and check if rule is still working.

Thank you Denis!