So I have my own java springboot code that writes an excel spreadsheet with a List from my local directory. Basically it just takes the list of files in a directory I want, and then lists out the contents of each zip file in the directory into an excel spreadsheet. And then I use FileOutputStream to generate that XLS into another directory. The code look something like:
HSSFWorkbook workbook = new HSSFWorkbook();
Sheet sheet = workbook.createSheet("Test sheet");
/*
...
insert code to create the rows and cells of the workbook/sheet
...
*/
FileOutputStream fileOutputStream = new FileOutputStream("/test/random/excelspreadsheets")
workbook.write(fileOutputStream);
fileOutputStream.close();
So this writes the xls, generates it and saves it into specified directory, but my question is, how do I send this as an email, with a subject, cc, from, to, and most importantly as an attachment to the email to specified either my email or friends email? I've been scratching my head at this for the past day and have no idea, it just seems obscure to me. Thank you!