/** * Constructor for initializing the attachment with a file * * @param file The file object */ public EmailAttachment(File file) { datasource = new FileDataSource(file); shortFilename = file.getName(); datasource.setFileTypeMap(new AttachmentTypeMap()); }