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 09:57 PM
It looks so easy to create a [.msg] file ...
In fact , i don't think [.msg] file can be create so easily ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 10:01 PM
Can you please provide some more details?
Is anything wrong in script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 10:15 PM - edited 02-19-2023 10:17 PM
I think [.eml] file is the best way ..not [.msg] .
And it looks like you are writing a [.eml] file. have a try to change the file name to [xxxxxx.eml] ?
Refer this link Here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 10:22 PM
But my requirement is to convert the email to .msg file not in .eml