Parsing .eml/.msg email attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2019 12:14 PM
Hi all,
So it's been asked, and answered, whether or not we can parse email attachments that are CSV or Excel file formats. However, we have a business requirement to instead parse .eml or .msg email attachments.
The general purpose of this is to parse the attached .eml/.msg file, check for a specific key-value pair in the HTML body (or in the header) of the attachment, and then process the original inbound email accordingly.
I understand that this is already something that is taken care of by Security Incident / Security Incident Response functionality, but we do not currently use this feature. Right now we need something that is more generic that allows us to handle these .eml and .msg via inbound Incident creation.
Thanks!
- 2,550 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2020 03:21 AM
Thanks
However, my usecase is to parse the email(.msg) file attached to a RITM# record(sc_req_item table). I've used the following script:
var gr = new GlideRecord('sys_attachment');
var sa = new GlideSysAttachment();
var stringUtil = new GlideStringUtil();
gr.addEncodedQuery('table_name=sc_req_item^table_sys_id='+current.sys_id);
gr.query();
while(gr.next())
{
var binData = sa.getBytes(gr);
var encData = stringUtil.base64Encoe(binData);
var data_string = stringUtil.base64Decode(encData);
gs.print(data_string);
}
The output I'm receiving as -
�w^~)�
The body of the .msg file contains the following text - 'This is the content.'
Can you please let me know where I'm going wrong.
Thanks,
Bhavana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2020 03:52 AM
Hi,
For .msg files you cannot use this command.
You need to use this application:
https://store.servicenow.com/sn_appstore_store.do#!/store/application/2651741c1b9008504a16db56dc4bcb30
Best regards,
Lior grinberg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2021 02:42 AM
Thanks
As far as I've understood, the Data Extract application is licensed. Can you please provide more insight on Data Extract about how it works as I was not able to find any documentation for it?
Can you please let me know if there is any other alternative available which is free of cost?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2021 02:07 PM
Hi Tippireddy - Were you able to solve this?
I am looking for same scenario
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2021 07:23 AM
Hi Khushbu,
No, as the Data Extract application is licensed and we couldn't find any other alternative we dropped the requirement.