sendMailWithAttachment is not a member of org.openhab.core.thing.binding.ThingActions

I can use the sendMail action but the sendMailWithAttachment does not work, neither do other attachment actions. The all report the same thing in the logs:

2023-01-02 21:40:44.092 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘test-1’ failed: ‘sendMailWithAttachment’ is not a member of ‘org.openhab.core.thing.binding.ThingActions’; line 25, column 2, length 133 in test

val mailActions = getActions(“mail”,“mail:smtp:Gmail”)
mailActions.sendMail(“xxxxxxxxx@gmail.com”,“Test”,“Test body”)
mailActions.sendMailWithAttachment(“xxxxxxxxxx@gmail.com”,“Test”,“Test body”, “http://contacam:81/SideFrontYard/lastperson.gif”)

In the above code sendMail works successfully.

In DSL rules, use “sendMail” Even with attachments. This was probably not renamed for backward compatibility.
I believe the documentation is not clear about that.

it ( even ) contains an example for ( has Html in the name )

sendHtmlMailWitAttachments.

Instead the problem here most probably is

mailActions.sendMailWithAttachment

versus ( taken from the docs ( there is an s at the end ) )

mailActions.sendMailWithAttachments

So the error message complains about the missing s.

Looking at the code, I expect only methods sendMail and sendHtmlMail but with different variants to be able to attach one attachment or a list.
A mapping table should be added in the documentation, even if it is very simple.

And of course we could add sendMailWithAttachment (and others) for DSL rules too.

Thanks you are correct. sendMail worked with an attachment URL!!

I proposed a change for OH4 to make actions names consistent over all rule engines, keeping also old names for DSL:

That way, documentation is correct (with no change required).

For your information, the enhancement is now merged. In DSL rules, you can both syntaxes (method names) but now the syntax with method names from README will work.