Not able to open .msg file in outlook
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 09:31 PM
Currently, I am attaching email to the incident with .msg file extension.
To achieve this I have written one script include.
It's attaching the email to incident with .msg file but when I tried to open it's showing me error.
Here is my script include:
var emailAsAttachmentUtil = Class.create();
emailAsAttachmentUtil.prototype = {
initialize: function() {
this.newLineChar = "\n"; // Microsoft Windows expects \r and \n for return and new line
this.contentType = "application/octet-stream";
},
createAttachment: function (emailRec, currentRec) {
var fileName = emailRec.subject + '.msg';
// Setup array to push email values into. Add additional as needed/
var emailData = [];
emailData.push("To: " + emailRec.to);
emailData.push("Subject: " + emailRec.subject);
emailData.push("From: " + emailRec.origemail);
//emailData.push(emailRec.body_html);
emailData.push('\n'+emailRec.body_text);
// Convert emailData to a string separated by new line character.
var emailString = emailData.join(this.newLineChar);
// Create attachment with email string and attach it to the record creatd by the email.
var sysAttachment = new GlideSysAttachment();
sysAttachment.write(currentRec, fileName, this.contentType, emailString);
},
type: 'emailAsAttachmentUtil'
};
Here is my ss for more info:
Thanks in advance.
Regards,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 11:01 PM
@Pratiksha2
I can't find anymore information about create .msg file via javascript except below link.
https://www.independentsoft.de/msgjs/index.html
But it's not free and only support ES6 (snow only support ES5 if i rememebered correctly)
But,you can create .msg file by java(or other develop language) via mid-server...
refer this:https://github.com/ctabin/jotlmsg
Maybe it's not a best way ,but if you insist on the .msg file, this may help you.