in src/main/java/org/apache/commons/mail/MultiPartEmail.java [447:476]
public MultiPartEmail attach(
final DataSource ds,
String name,
final String description,
final String disposition)
throws EmailException
{
if (EmailUtils.isEmpty(name))
{
name = ds.getName();
}
final BodyPart bodyPart = createBodyPart();
try
{
bodyPart.setDisposition(disposition);
bodyPart.setFileName(MimeUtility.encodeText(name));
bodyPart.setDescription(description);
bodyPart.setDataHandler(new DataHandler(ds));
getContainer().addBodyPart(bodyPart);
}
catch (final UnsupportedEncodingException | MessagingException me)
{
// in case the file name could not be encoded
throw new EmailException(me);
}
setBoolHasAttachments(true);
return this;
}