The code change will take the last bit of the
attachmentUrl and use it as a name for the attachment. So if the last bit (before any parameters) is
snap.cgi, for example, then you will get an attachment named
snap.cgi, which is also not terribly useful in an email client. But if the last bit is
snap.jpg, it should work correctly in your email client.
In the case where the the attachment name’s extension is not the same as the type of file and you would like it to be, I recommend pulling the attachment to the openHAB server’s
/tmp directory first in your script or rule (possibly exec’ing
curl to do that), naming it as you want to see it attached, and then using a URL like
file:///tmp/mylovelyimage.jpg to attach it to the email.