<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to send individual emails that appear in the search results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368118#M169798</link>
    <description>&lt;P&gt;This is from another Q&amp;amp;A:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/399434/send-emailed-results-to-an-email-address-in-the-re.html#answer-399515"&gt;https://answers.splunk.com/answers/399434/send-emailed-results-to-an-email-address-in-the-re.html#answer-399515&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you need to send a contextually-appropriate subset of results to some people, you can skip the configuration-based email settings and do this in SPL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | outputcsv TempFile.csv
| stats values(Email_Address) AS emailToHeader | mvexpand emailToHeader
| map search ="|inputcsv TempFile.csv | where Email_Addresss=\"$emailToHeader$\"
   | fields - Email_Address
   | sendemail
      sendresults=true inline=true
      server=\"Your.Value.Here\"
      from=\"Your.Value.Here\"
      to=\"$emailToHeader$\"
      subject=\"Your Subject here: \$name\$\"
      message=\"This report alert was generated by \$app\$ Splunk with this search string: \$search\$\""
| where comment="MakeSureNoEventsRemail"
| append [|inputcsv TempFile.csv]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 30 Apr 2018 18:39:22 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2018-04-30T18:39:22Z</dc:date>
    <item>
      <title>How to send individual emails that appear in the search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368115#M169795</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;

&lt;P&gt;I have search results with CUID is the  email(I will append my company domain to CUID, so that mail will go to person) and attached the sample result for the same .How to send the individual emails for all the users  along with server name.&lt;/P&gt;

&lt;P&gt;I have used send mail command , but it is sending only one mail to the user appear in the first result. I need to send mail to all the users that  appears in the list.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4854iF76DCC2471260B7D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Please help me on this.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 11:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368115#M169795</guid>
      <dc:creator>pavaninpdl</dc:creator>
      <dc:date>2018-04-30T11:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to send individual emails that appear in the search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368116#M169796</link>
      <description>&lt;P&gt;Did you try the map command?, &lt;/P&gt;

&lt;P&gt;Look at below answer&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/627366/sending-emails-to-users-that-appear-in-search-resu.html"&gt;https://answers.splunk.com/answers/627366/sending-emails-to-users-that-appear-in-search-resu.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 17:48:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368116#M169796</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2018-04-30T17:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to send individual emails that appear in the search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368117#M169797</link>
      <description>&lt;P&gt;You can use the map command along with the sendemail command, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with all the fields mentioned in the screenshot
| map maxsearch=1000 search="| gentimes start=-1 | eval HOSTNM=\"$HOSTNM$\" |..other fields | sendmail to=\"$CUID$\" ..."
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 17:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368117#M169797</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-30T17:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to send individual emails that appear in the search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368118#M169798</link>
      <description>&lt;P&gt;This is from another Q&amp;amp;A:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/399434/send-emailed-results-to-an-email-address-in-the-re.html#answer-399515"&gt;https://answers.splunk.com/answers/399434/send-emailed-results-to-an-email-address-in-the-re.html#answer-399515&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you need to send a contextually-appropriate subset of results to some people, you can skip the configuration-based email settings and do this in SPL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | outputcsv TempFile.csv
| stats values(Email_Address) AS emailToHeader | mvexpand emailToHeader
| map search ="|inputcsv TempFile.csv | where Email_Addresss=\"$emailToHeader$\"
   | fields - Email_Address
   | sendemail
      sendresults=true inline=true
      server=\"Your.Value.Here\"
      from=\"Your.Value.Here\"
      to=\"$emailToHeader$\"
      subject=\"Your Subject here: \$name\$\"
      message=\"This report alert was generated by \$app\$ Splunk with this search string: \$search\$\""
| where comment="MakeSureNoEventsRemail"
| append [|inputcsv TempFile.csv]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 18:39:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/368118#M169798</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-30T18:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to send individual emails that appear in the search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/557760#M169799</link>
      <description>&lt;P&gt;It's pretty simple, don't even need to use map command. Just enable send email alert action and in to: field set $result.email$ (email - depend upon your field name in Splunk result) and select trigger "for each result". Email will be send to the respective email address for each line of result.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.3.3/Alert/Emailnotification#Send_email_to_different_recipients_based_on_search_results" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/6.3.3/Alert/Emailnotification#Send_email_to_different_recipients_based_on_search_results&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 07:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-individual-emails-that-appear-in-the-search-results/m-p/557760#M169799</guid>
      <dc:creator>sirajnp</dc:creator>
      <dc:date>2021-06-30T07:42:57Z</dc:date>
    </item>
  </channel>
</rss>

