Dear Team,
We are using Aspose Email for one the requirment , Where we are having some .msg template
which are loading using MailMesaage and trying to attach some document as add attachment is avaiable in Mail Message class.
and saving the same . The issue is when we open the msg file which is created as part of conversion . we are not getting issue that while sending mail the content which user pass in the mail is not passing … The mail is going blank without added body content by user
try {
String parsedAttch = request.getParameter(“attachments”);
String[] parsedAttachArray = parsedAttch.split(",");
loadAsposeLicense();
Attachment att;
session = getDfSession();
IDfDocument msgTemplate = (IDfDocument) session.getObject(new DfId(template));
MailMessage msg = MailMessage.load(msgTemplate.getContent());
MapiMessage mapiMsg = MapiMessage.fromStream(msgTemplate.getContent());
for (String attachIds : parsedAttachArray) {
IDfDocument attachId = (IDfDocument) session.getObject(new DfId(attachIds));
att = new Attachment(attachId.getContent(), attachId.getContentType());
String name = attachId.getObjectName();
String extension = attachId.getFormat().getDOSExtension().toLowerCase();
if (!name.toLowerCase(Locale.ENGLISH).endsWith("." + extension)) {
name = name + “.” + extension;
}
att.setName(name);
msg.addAttachment(att);
}
MailAddressCollection mailAddColl = new MailAddressCollection();
MailAddress mailAdd = new MailAddress(“EDM.Administrator@ing.be”);
msg.setTo(mailAddColl);
msg.setCC(mailAddColl);
msg.setFrom(mailAdd);
msg.setSubject(mapiMsg.getSubject());
msg.setSubjectEncoding(StandardCharsets.UTF_8);
response.setStatus(200);
response.setHeader(“Content-Disposition”, “attachment; filename=”" + msgTemplate.getObjectName()
+ “.msg”");
response.setContentType(“application/vnd.ms-outlook”);
msg.save(response.getOutputStream(), MailMessageSaveType.getOutlookMessageFormatUnicode());
logger.info("createMailFromTemplate " + template);