[OH3]Binding Mail

The example will not run like in the Description of the Binding. Which Syntax I have to use for sending an E-Mail within a rule?

Thank you for taking the time to answer my question.

Probably the manual should getting fixed.

I did setup based on manual and use in rules below syntax:

val mailActions = getActions("mail","mail:smtp:mailthingid")

mailActions.sendMail("receiver@gmail.com", "[TEST] Subject", "E-mail content")

Also in OH3?

What error do you get?

The method or field mailAction is undefined; line 1, column 0, length 10


Could you paste your code here?

val mailAction = getActions(“mail”,“mail:imap:UIDUIDUID”)
mailActions.sendMail(“dennis@webpage.de”, “Alarm wurde ausgelöst”, “Bitte Polizei verständigen”)

RuleDSL is the right application for it?

You have typo here:
mailAction vs mailActions

And Yes, RuleDSL is the right place.

Ohy my god I am an idiot!!! Thanks a lot. Now the next error:

The method sendMail(String, String, String) is undefined for the type ThingActions; line 2, column 74, length 8

The Thing is configurated as an item over the web configuration. not as a thing in a file.

No, you’re not!

Regarding the next issue I have only one idea: check if there is no typo here “mail:imap:UIDUIDUID”

Could you please share screenshot with Thing definition?

Call me an Idiot :smiley:

I only configured a IMAP Server not an SMTP. Deeply sorry.

@admin: Please delete this Thread. It is not helpful.

I’ve seen IMAP, but I thought that this is on purpose :rofl:

Have a nice evening/night!

1 Like

All good. Others may come across the same and find the comments useful.

Having a problem with message send as well.
this is my script to be exacuted when button = ON

val mailActions = getActions("mail","mail:smtp:google") 
val success = mailActions.sendMail("name.name2@outlook.com", "Test subject", "This is the mail content.")

Received warning message:

[WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.internet.AddressException: Local address contains control or whitespace in string ``OpenHab 3

What shall be the IP address in the bridge thing?

My guess would be that the sender is not an email address.

localhost cannot be the address of your providers smtp server. You need to lookup the correct settings.