I am using a virtual filesystem and I'd like to attach a file from it to an email. However, the MimeBodyPart object only takes Files, which don't work on a default filesystem like jimfs. See my code below, where I get an UnsupportedOperation exception when I try to convert to file.
public Email attach(Path file){
MimeBodyPart attachment = new MimeBodyPart()
attachment.attachFile(file.toFile())
attachments.add(attachment)
return this
}