We use the Aspose Email java package to extract attachments from msg files. Some msg files contain MS Teams Emoji, Sticker and GIFs (or Giphy). Their links are extracted as part of the email body(see below), but the images are not treated as attachment and thus not downloaded.
Emoji:
Sticker:
Giphy:
Wonder if you can treat them as ReferenceAttachment with URI set with the link so that we can easiely find them and download them with the URI.
Following is the sample code and attached are three sample files. The operating system is Ubuntu 20.04. Java version is 21. Aspose Email java packages is 24.7.
Sample code:
import com.aspose.email.Attachment;
import com.aspose.email.LinkedResource;
import com.aspose.email.MailMessage;
import com.aspose.email.MsgLoadOptions;
public class ExtractEmojiStickerGiphy_32 {
public static void main(String[] args) {
try {
String filepath = "/home/ubuntu/winshare/00_Sample_Files/Msg_with_Emoji_Sticker_Giphy/6_with_att_pic.msg";
String outputDir = "/home/ubuntu/winshare/00_Sample_Files/Msg_with_Emoji_Sticker_Giphy/outdir/";
// Open message
MailMessage mailMessage = MailMessage.load(filepath, new MsgLoadOptions());
// Extract test
String emailBody;
if (mailMessage.isBodyHtml()) {
emailBody = mailMessage.getHtmlBodyText(true);
} else {
emailBody = mailMessage.getBody();
}
if (emailBody != null) {
System.out.println(emailBody);
} else {
System.out.println("Failed to get email body");
}
// Save attachments
for (int i = 0; i < mailMessage.getAttachments().size(); i++) {
Attachment attachment = mailMessage.getAttachments().get_Item(i);
String outputFile = outputDir + "attachment_" + i;
attachment.save(outputFile);
}
// Save embedded objects
for (int i = 0; i < mailMessage.getLinkedResources().size(); i++) {
LinkedResource attachment = mailMessage.getLinkedResources().get_Item(i);
String outputFile = outputDir + "embedded_" + i;
attachment.save(outputFile);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
These items are extracted as part of the email body rather than being treated as attachments, which makes it difficult to download them.
You might need to implement a custom solution to parse the email body for these links and handle their download separately, as they are not treated as standard attachments.
Unfortunately, we are unable to treat external links to resources in the email body as attachments.
However, this can be implemented using Java by parsing the email body to extract and handle img links.
In addition to downloading Emoji, Sticker and Giphy images, we are interested in retrieving the related information like who did the reaction and when did it happen. It is mentioned that MapiReactionsBlob and ReactionsSummary contain those information in this article: Reactions in Outlook: Public usability update September 2023 - Microsoft Community Hub. Wonder if you can help us to get those information.
@margarita.samodurova can you let me know what the issue ID EMAILNET-41430 covers for your investigation? Also, will a corresponding ticket be opened on the java side?