in commons-email2-jakarta/src/main/java/org/apache/commons/mail2/jakarta/MultiPartEmail.java [248:259]
public MultiPartEmail attach(final Path file, final OpenOption... options) throws EmailException {
final Path fileName = file.toAbsolutePath();
try {
if (!Files.exists(file)) {
throw new IOException("\"" + fileName + "\" does not exist");
}
return attach(new PathDataSource(file, FileTypeMap.getDefaultFileTypeMap(), options), Objects.toString(file.getFileName(), null), null,
EmailAttachment.ATTACHMENT);
} catch (final IOException e) {
throw new EmailException("Cannot attach file \"" + fileName + "\"", e);
}
}