Skip to content
SPL // Splunk

Using the sendemail Command

KGI Avatar
 

Written by: Eric Holsinger | Last Updated:

 
December 5, 2025
 
Search Command Of The Week: sendemail
 
 

Originally Published:

 
December 5, 2025

Introduction: SPL & Practical Applications of sendemail

Splunk’s Search Processing Language (SPL) helps users explore and analyze machine data. It also allows teams to automate responses based on real-time events. SPL includes many commands, yet a few stand out because they support direct action. The sendemail command is one of these commands. It delivers search results to people who must respond quickly. Therefore, it is often used in alerts, scheduled reports, and operational workflows. 

Many teams rely on email for communication. Because of that, sendemail helps close the gap between detection and response. Instead of waiting for users to open Splunk, the system can send important information out immediately. 

Understanding the sendemail Command

The sendemail command takes the output of a search and sends it by email. Although it sounds simple, the command offers flexibility. It can attach search results as a CSV file, show them inline in a message, or embed a chart. It can also send dashboards as PDFs. Due to this range of options, the command is used by teams across security, IT operations, and development. 

The command does not change event data. Instead, it transforms insight into communication that people can act on. Because of this, sendemail is an essential part of many Splunk workflows.

 

It is important to know that the sendemail command requires a configured SMTP server to function properly.

Benefits of the sendemail Command

  • Improved communication: Important information reaches people quickly, even if they are away from Splunk. 
  • Consistent reporting: Scheduled searches can generate daily or weekly summaries without manual effort. 
  • Better cross-team visibility: Teams without Splunk access still receive the results they need. 

Proper Syntax

The basic syntax is simple. It uses key-value pairs to control how the email is created. This structure makes the command easy to customize. 

				
					| sendemail  
[from=<email_list>] 
[cc=<email_list>] 
[bcc=<email_list>] 
[subject=<string>] 
[format=csv | table | raw] 
[inline= <bool>] 
[sendresults=<bool>] 
[sendpdf=<bool>] 
				
			

There are other options available, but the “to” option is the only one required.  

Usage Examples & Practical Applications

Example #1: Notify Security Analysts of Authentication Failures

This example uses the Authentication data model. It sends a message when failed login attempts reach a threshold. The search helps analysts react quickly when unusual patterns appear. 

				
					| tstats count from datamodel=Authentication where Authentication.action=failure by Authentication.user 
| where count > 20 
| sendemail  
      to="soc@company.com 
     subject="High Authentication Failure Rate" 
      message="There are more than 20 failed logins for at least one user." 
      inline=true  
      format=html
				
			
Example #2: Send a CSV of HTTP Error Activity

This example uses the Web data model. It creates a short report of endpoints returning errors. Teams often use this type of search in scheduled reports. 

				
					| tstats count from datamodel=Web where Web.status>=500 by Web.uri_path Web.status 
| sendemail 
      to="webteam@company.com" 
      subject="Daily API Error Summary" 
      message="Attached is today's list of endpoints that returned errors." 
      sendresults=true 
     Format=csv
				
			
Example #3: Alert on Network Traffic Spikes

This example uses the Network Traffic data model to identify high volumes of outbound traffic. It helps network teams detect potential data exfiltration or unexpected spikes. When outbound bytes exceed a set threshold, Splunk emails the network team so they can review the abnormal activity. 

				
					| tstats sum(Network_Traffic.bytes_out) as total_bytes from datamodel=Network_Traffic by Network_Traffic.dest  
| where total_bytes > 500000000  
| sendemail to="network-ops@company.com"  
subject="Unusual Outbound Traffic Detected"  
message="A destination has exceeded normal outbound volume. Review the details in this alert."  
inline=true  
format=html 
				
			

Conclusion

The sendemail command connects Splunk searches to real-world action. It helps teams distribute insights, automate communication, and support rapid response. When used correctly, it becomes a key part of an operational workflow. 

Key points to remember: 

  • The command turns search results into useful notifications. 
  • It supports inline tables, custom subjects and messages, and multiple formats. 
  • It helps teams react faster by sending essential information directly. 

To access more Splunk searches, check out Atlas Search Library, which is part of the Atlas Platform. Specifically, Atlas Search Library offers a curated list of optimized searches. These searches empower Splunk users without requiring SPL knowledge. Furthermore, you can create, customize, and maintain your own search library. By doing so, you ensure your users get the most from using Splunk.

Helpful? Don't forget to share this post!
LinkedIn
Reddit
Email
Facebook