- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 02:34 AM
Hi,
I have a issue when trying to attach the email as an attachment to the record in inbound action.
Please someone guide me for this.
var strEmailContent = email.content_type +"\n"+ email.headers + "\n\n\n\n"+ email.body;
var sa = new GlideSysAttachment();
sa.write(current, email.subject +".eml", "application/octet-stream ", strEmailContent);
current.insert();
but this was not working. can someone please help me with this.
For anyone who is facing this issue I was able to figure out the issue and I will update the correct code below.
var attachment = new GlideSysAttachment();
var fileName = email.subject + '.eml';
var contentType = 'application/octet-stream';
var content = email.content_type + "\n" + email.headers + "\n\n\n\n" + email.body_text;
attachment.write(current, fileName, contentType, content);
current.insert();
In the below line,
var content = email.content_type + "\n" + email.headers + "\n\n\n\n" + email.body_text;
make sure to add email.body_text not email.body.
If you use email.body you will not able to see the output.
If you use email.body_text you will be able to see the output.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 12:19 AM
This is the correct answer.
In the var content use email.body_text. If you use email.body you will not see the output.
var attachment = new GlideSysAttachment();
var fileName = email.subject + '.eml';
var contentType = 'application/octet-stream';
var content = email.content_type + "\n" + email.headers + "\n\n\n\n" + email.body_text;
attachment.write(current, fileName, contentType, content);
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 02:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 04:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 12:19 AM
This is the correct answer.
In the var content use email.body_text. If you use email.body you will not see the output.
var attachment = new GlideSysAttachment();
var fileName = email.subject + '.eml';
var contentType = 'application/octet-stream';
var content = email.content_type + "\n" + email.headers + "\n\n\n\n" + email.body_text;
attachment.write(current, fileName, contentType, content);
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:17 AM
It is working. But, if the inbound email contains any attachments they are not showing in Outlook attachment(in that eml file).