@Test void serviceShouldDecodeFilenameAndSaveAttachmentInAFolderWhenPatternMatchAndDecodeFilenameTrue(TemporaryFolder temporaryFolder) throws MessagingException { Mailet mailet = initMailet(temporaryFolder); String expectedAttachmentContent = EXPECTED_ATTACHMENT_CONTENT; MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder() .setMultipartWithBodyParts( MimeMessageBuilder.bodyPartBuilder() .data("simple text"), createAttachmentBodyPart(expectedAttachmentContent, "=?iso-8859-15?Q?=E9_++++Pubblicit=E0_=E9_vietata____Milano9052.tmp?=", TEXT_HEADERS), createAttachmentBodyPart("\u0014£áâä", "temp.zip", TEXT_HEADERS)); Mail mail = FakeMail.fromMessage(message); mailet.service(mail); Optional<Collection<AttributeValue<String>>> savedAttachments = AttributeUtils.getValueAndCastFromMail(mail, StripAttachment.SAVED_ATTACHMENTS, COLLECTION_STRING_CLASS); assertThat(savedAttachments) .isPresent() .hasValueSatisfying(attachments -> { assertThat(attachments).hasSize(1); String name = attachments.iterator().next().value(); assertThat(name.startsWith("e_Pubblicita_e_vietata_Milano9052")).isTrue(); assertThat(new File(temporaryFolder.getFolderPath() + name)).hasContent(expectedAttachmentContent); }); }
@Override public void service(Mail mail) throws MailetException { MimeMessage message = getMessageFromMail(mail); if (isMultipart(message)) { processMultipartPartMessage(message, mail); } }
StripAttachment extends GenericMailet { @Override public void service(Mail mail) throws MailetException { MimeMessage message = getMessageFromMail(mail); if (isMultipart(message)) { processMultipartPartMessage(message, mail); } } }
StripAttachment extends GenericMailet { @Override public void service(Mail mail) throws MailetException { MimeMessage message = getMessageFromMail(mail); if (isMultipart(message)) { processMultipartPartMessage(message, mail); } }  }
StripAttachment extends GenericMailet { @Override public void service(Mail mail) throws MailetException { MimeMessage message = getMessageFromMail(mail); if (isMultipart(message)) { processMultipartPartMessage(message, mail); } }  @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); }
StripAttachment extends GenericMailet { @Override public void service(Mail mail) throws MailetException { MimeMessage message = getMessageFromMail(mail); if (isMultipart(message)) { processMultipartPartMessage(message, mail); } }  @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); static final String PATTERN_PARAMETER_NAME; static final String NOTPATTERN_PARAMETER_NAME; static final String MIMETYPE_PARAMETER_NAME; static final String ATTRIBUTE_PARAMETER_NAME; static final String DIRECTORY_PARAMETER_NAME; static final String REMOVE_ATTACHMENT_PARAMETER_NAME; static final String DECODE_FILENAME_PARAMETER_NAME; static final String REPLACE_FILENAME_PATTERN_PARAMETER_NAME; static final String REMOVE_NONE; static final String REMOVE_ALL; static final String REMOVE_MATCHED; static final AttributeName REMOVED_ATTACHMENTS; static final AttributeName SAVED_ATTACHMENTS; static final boolean DECODE_FILENAME_DEFAULT_VALUE; }