How to attach file in disk to an email dynamically?

1
0
-1

We tried to attach file by running a script as follows. But, it didn't attach file to the email. Let me know if there are any other ways of doing this or mistakes in this attempt.

import java.io.File;
import java.util.logging.Logger;

File readFile() {
Logger logger = Logger.getLogger("org.bonitasoft");
File file = new File("C:\\Users\\sachinm\\Downloads\\testDoc.txt")
logger.info("File read");
return file;
}

readFile();

1 answer

1
0
-1
This one is the BEST answer!

Hi Sachin,

To attach a file to your email, you can create a new document in your pool and initiate it from the file system or contract.

So, for your example, you can specify your file "C:\\Users\\sachinm\\Downloads\\testDoc.txt".

In the connector, you just have to select your document as an attachment.

I hope this will help you.

Notifications