I have the following class called sendAttachment.java, and also Piechart.java, and covertExcelTOCSV.java. I am reading in an els file converting it to csv and then having pi
The NullPointerException is being thrown in MimeUtility (line 226), rather than in the class you posted (though the problem likely originates in your code).
It looks like it has something to do with encoding. Without being able to delve into the code it's hard to know. Some things you could experiment with...
Try removing the parameter when you create the MimeMultipart:
MimeMultipart multipart = new MimeMultipart();
Try attaching a different kind of file, e.g. a text file. Perhaps it can't detect the appropriate encoding for a "jpg" file.