Getting Data In

Can you help me figure out this error I'm getting with a search using the sendemail command?

vumanhtai
Path Finder

Hi Splunk Team!

I have a query as shown below:

my search | outputlookup emailspam.csv | sendemail  from= server=  subject=Alert message="text"  to=[|inputlookup emailspam.csv]

In general, my search prints all the result emails to file "emailspam.csv", and later on, I use this file as the receiving addresses. However, after running this query, I got an error :

command="sendemail", {} while sending mail to

I know the issue comes from " to=[|inputlookup emailspam.csv]"

I want to send all emails in file emailspam.csv

0 Karma
1 Solution

DMohn
Motivator

Assuming your CSV contains a list of email adresses, you have to convert this to a comma-separated string of recipients.

Try the following:

my search | outputlookup emailspam.csv | sendemail from= server= subject=Alert message="text" [|inputlookup emailspam.csv | mvcombine email| eval to=mvjoin(email,", ") | return to]

This assumes you have one field in your CVS named email. Change the command if needed.

View solution in original post

0 Karma

DMohn
Motivator

Assuming your CSV contains a list of email adresses, you have to convert this to a comma-separated string of recipients.

Try the following:

my search | outputlookup emailspam.csv | sendemail from= server= subject=Alert message="text" [|inputlookup emailspam.csv | mvcombine email| eval to=mvjoin(email,", ") | return to]

This assumes you have one field in your CVS named email. Change the command if needed.

0 Karma

vumanhtai
Path Finder

thank DMohn!

0 Karma

DMohn
Motivator

Can you post an example of your |inputlookup output, e.g. how the CSV file looks like?

0 Karma

vumanhtai
Path Finder

Hi DMohn!
file emailspam.csv:
from
email1
email2
email3
email4

0 Karma

DMohn
Motivator

In that case you can use the query I stated in the answer below, just replace the email field with from

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...