How to use var email = new GlideEmailOutbound();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 01:43 AM
Hello I want to send an email from ServiceNow script include. The sender of email id will be for example sender1@gmail.com and receiver as receiver2@gmailcom. Can we use
var email = new GlideEmailOutbound(); for this? How to use this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 12:22 PM
First step your script needs to be under Global application.
then try to use this sample script it works well for me
var email = new GlideEmailOutbound();
email.setSubject("Email subjct");
email.setBody('The Email Body');
email.setFrom('set the from here');
email.addRecipient('recipient');
email.save();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 12:23 PM
First step your script include needs to be under Global application.
then try to use this sample script it works well for me
var email = new GlideEmailOutbound(); email.setSubject("Email subjct"); email.setBody('The Email Body'); email.setFrom('set the from here'); email.addRecipient('recipient'); email.save();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 01:48 AM
Hi @dev115415
You can use GlideEmailOutbound() API for this provided you don't want to send any attachment with the email. It is a scoped API for which documentation is available on https://docs.servicenow.com/bundle/vancouver-api-reference/page/app-store/dev_portal/API_reference/G...
You can refer to it and set your script accordingly.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.