if (null != originalRecipients && originalRecipients.length > 0)
{
original_recipient = originalRecipients[0];
}
MailAddress soleRecipient = ActionUtils.getSoleRecipient(aMail);
String final_recipient = soleRecipient.toString();
String original_message_id = aMail.getMessage().getMessageID();
DispositionModifier modifiers[] = {new ModifierError()};
Disposition disposition = new Disposition(new ActionModeAutomatic(),
new SendingModeAutomatic(), new TypeDeleted(), modifiers);
MimeMultipart multiPart = MDNFactory.create(humanText.toString(),
reporting_UA_name, reporting_UA_product, original_recipient,
final_recipient, original_message_id, disposition);
// Send the message
MimeMessage reply = (MimeMessage) aMail.getMessage().reply(false);
reply.setFrom(soleRecipient.toInternetAddress());
reply.setContent(multiPart);
reply.saveChanges();
Address[] recipientAddresses = reply.getAllRecipients();
if (null != recipientAddresses)
{
Collection recipients = new ArrayList(recipientAddresses.length);
for (int i = 0; i < recipientAddresses.length; i++)
{
recipients.add(new MailAddress(
(InternetAddress) recipientAddresses[i]));
}
context.post(null, recipients, reply);
}
else