How to send mails in OH3?

I can’t be sure but that looks a whole lot like the old Mail Action. I don’t think those old 1.x version Actions were ported over to OH 3. Now Actions like that are installed with the bindings instead of separately. So have you installed the Mail binding and configured an SMPT Thing with your SMTP server’s information and credentials? Then you need to pull the Action associated with that Thing to call sendHtmlMail

val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendHtmlMail("mail@example.com", "Test subject", "<h1>Header</h1>This is the mail content.", attachmentUrlList)

I’ve posted a tutorial for how to configure it with gmail at How to configure the Mail Binding to use GMail for sending email from openHAB

2 Likes