Alerting

Send one email to multiple recepients using action.email

Poojitha
Communicator

Hi All,

I  have created an alert that  looks for instances with no proper tags . The search in alert  will return instance name and  instance owner.  On scheduled time,  email notification is getting sent to all owners with the csv file attached. 


I am using action.email.to=$result.email_address$ (dynamic email address returned from search). Through this, the email  notification is getting sent successfully to all users in $result.email_address$ but is getting sent separately. I want all of the users to be in to field , so that one email will be sent.

Please let me know how we are achieving this ?

Regards,
PNV

Labels (2)
Tags (2)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

It's not up to Splunk. It's up to the email infrastructure. In the end email to many recipients ends as many single emails in each of the recipient's mailbox. So i'm not quite sure what you want to achieve here.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

can you clarify what you are meaning with this?

I am using action.email.to=$result.email_address$ (dynamic email address returned from search). Through this, the email  notification is getting sent successfully to all users in $result.email_address$ but is getting sent separately. I want all of the users to be in to field , so that one email will be sent.

If I understood correctly you can send email to those users but "it's not sent like you want"? 

r. Ismo

0 Karma

Poojitha
Communicator

@isoutamo  :Yes it is not getting sent like I want.

I want all the emails recipients to be in "to" field with my email-id in Cc. There are around 100 email address returned from search. If emails are sent separately, then by inbox will be bombarded with 100 emails  This makes me difficult to follow up as well.

So, I want to send one email . This is my requirement.

Regards,
PNV

0 Karma

isoutamo
SplunkTrust
SplunkTrust
If you have several duplicate email address in to field then you could add dedup or something similar (stats + values) to remove those.
0 Karma

Poojitha
Communicator

@isoutamo  No sir, its not about duplicates.
z
Let me be more clear then.

Example : Below is my example result from alert search.

Instance NameOwnerTags
i-test1[email protected]Incorrect
i-test2[email protected]Missing
i-test3[email protected]Missing


Now I have to send email to these three users with all of them in "to" field.

How I am setting email address ? using $result.Owner$. This is getting all three emails returned from result and alert notification is getting sent. But it is getting sent as three separate emails.
One email to [email protected],
Another separate email to [email protected]
Third separate email to [email protected]
For all of these three emails , [email protected] is in CC. 

This is just an example with 3 users. But like this there are 100 owners and different instances. Sending separate emails to all 100 users with [email protected] will burden emailbox of [email protected] and also follow up will be difficult.

So, I have to send one email notification with all [email protected], [email protected] and [email protected] in "to" field and [email protected] in Cc.  This just sends one email with all owners in to field.

I want to achieve this using action.email.to.  This is my whole requirement. Please help me

Regards,
PNV

0 Karma

PickleRick
SplunkTrust
SplunkTrust

The sendemail.py script responsible for sending the emails just creates a single session and sends a single email to your configured SMTP server. The SMTP server is then responsible for sending the email away.

Anyway, if your emails are sent to three separate addresses on gmail, how do they land in admin's mailbox? You didn't mention anything about specifying a Cc: address in your sendemail command.

0 Karma

Poojitha
Communicator

@PickleRick : [email protected] will be mentioned in action.email.Cc="[email protected]".

action.email.to=$result.owner$
[email protected]

So, you mean sendemail.py script doesnot have capability to send one email to different users with all of them in to fields ? We cannot do that ?

Regards,
PNV

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Check in splunkd.log in your _internal index how is sendemail.py called.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

as @PickleRick said this is how email works. As you have there 3 separate email even account [email protected] will be as cc on all of those. There is no way how you can separate those into three separate emails with to-recipients and then merge those again into one for cc-recipient.

If you want that this works like you want, then you must change your process and handle this someway different way. Could you e.g. separate alert for two part: one for to recipients and second one for cc recipients? Unfortunately I'm afraid that this generates some other issues to you 😞

0 Karma

Poojitha
Communicator

@isoutamo  Yes sir. If my requirement cannot be met through sendemail.py script then I have to look for other way , like through some other tools I can handle this.

This is my actual requirement. It should be as below :

action.email.to=$result.owner$ - all users from result here
[email protected]$



I think then I cannot make this happen through alert capability in splunk then.

Note : gmail.com is just for example purpose here. This will be different in actual case, aligns with my org.

Regards,
PNV

0 Karma

isoutamo
SplunkTrust
SplunkTrust

If you are sending exactly same email to all recipients then you probably could use e.g. *stats command to combine all recipients to mv-field and then transfer that to for a,b,…. 

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!

Your Feedback. Our Roadmap. Visit the PX Feedback Booth at .conf26

You use Splunk every day, come and help shape what's next.  Save Your Seat: Product-Focused Sessions at ...

Agentic SOC Triage: Investigating Splunk ES Notables with MCP Server and a Local LLM

The Problem: Too Many Alerts, Too Little Context Security operations teams running Splunk Enterprise Security ...

Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas

Watch Now Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas     Do you ever feel ...