How can I add email senders to a list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 05:27 AM
Hi lovely community,
I am quite new here and also to ServiceNow. Perhaps someone can help me with this request.
I have been told to create a list of sent emails dating back to April for a few email accounts. I need to see the sender email address, date, subject, recipient, and state (processed, ignored, etc.). I can get the list by using sys_email and filtering out what they are asking for, but I don’t know how to add the sender to the list. I cant find any related field to sender or from. Most of the emails are notifications.
- Labels:
-
Architect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 06:15 AM - edited 10-02-2024 06:37 AM
In ServiceNow, when you're working with the sys_email table, you might notice that the sender information is often not immediately visible in the fields. However, the sender's email address is typically stored in the sys_email table under the from field, which can be a bit tricky to locate.
Access sys_email: Go to sys_email.list in ServiceNow.
Filter Records:
- Click the funnel icon.
- Set sys_created_on to filter emails from April onward.
Add Columns:
- Click the gear icon to customize the list.
- Add the following fields:
- From (sender)
- Date (sys_created_on)
- Subject
- Recipient (to)
- State
Export if Needed: Use the "Export" option for CSV or Excel.
Optional Script: For advanced queries, use the following script:
var gr = new GlideRecord('sys_email');
gr.addQuery('sys_created_on', '>=', '2024-04-01 00:00:00');
gr.query();
while (gr.next()) {
gs.info('Sender: ' + gr.from + ', Date: ' + gr.sys_created_on + ', Subject: ' + gr.subject + ', Recipient: ' + gr.to + ', State: ' + gr.state);
}
This script retrieves and logs the desired information for emails sent since April.
By following these steps, you should be able to compile a comprehensive list of sent emails with all the required fields, including the sender's email address.
if you found this helpful please accept as solution and mark helpful
best
Chetna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 06:33 AM
What exactly is the requirement? The emails are all sent from ServiceNow (either the default address or something you configured).
The 'from' is in the headers, so you could take this URL (https://[YOUR_INSTANCE].service-now.com/now/nav/ui/classic/params/target/sys_email_list.do%3Fsysparm...) and add a filter to do a 'contains' on the headers field, but from how many addresses is your instance sending emails?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 12:40 AM - edited 10-03-2024 12:41 AM
Primary place to look for 'from' address is the 'Headers' field of the email logs.
But in certain scenarios, you can also look at 'Reply to' field. For e.g., in some scenarios where SN needs to send email with different from addresses depending on the type of notification, we'll use the appropriate from address in the 'Reply-to' field in the email notification configuration. This will ensure when user replies, their responses go to the right mailbox. If you are doing something like that in your implementation then you consider using 'Reply to' field to get 'from' address.
PS: Hit "Correct", "Helpful" or "Like" depending on the impact of the response.
Regards,
Kamal S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 07:11 AM
Thank to all, between all you response I could get what I was looking for.