Setting relative fileNames path in mail-send

Dear Camunda community,

I am able to successfully specify fileNames parameter and attach a file to an email (and even to display it in html using cid). However, this only works when specifying absolute file name paths. Is there a way to use relative path names?

Configuration: Tomcat, Camunda-shared-7.9
Component: camunda-bpm-mail community extention

image

Best regards,
Ilya

Hi @Ilya_Malyarenko,

no, you have to pass an absolute path.

However, you can transform the relative path into an absolute one. For example, using a Java/JS expression:

new File("../E1.png").getCanonicalPath()

Does this help you?

Best regards,
Philipp

Hi @Philipp_Ossler,

Yes, I slightly modified a proposed solution to grab files from resources directory

ClassLoader classLoader = getClass().getClassLoader()
File logo = new File(classLoader.getResource("E1_logo.png").getFile())
path = logo.getCanonicalPath()

Thank you

Best regards,
Ilya