<?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 email to multi users one by one in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-multi-users-one-by-one/m-p/349025#M175219</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>Thu, 09 Mar 2017 00:46:04 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-09T00:46:04Z</dc:date>
    <item>
      <title>How to send email to multi users one by one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-multi-users-one-by-one/m-p/349024#M175218</link>
      <description>&lt;P&gt;I run a query and get the table like this,&lt;/P&gt;

&lt;P&gt;user        user_email                                  content &lt;BR /&gt;
Jack      &lt;A href="mailto:jack@abc.com"&gt;jack@abc.com&lt;/A&gt;                        abcmdsfsadfsadfsadfsdf &lt;BR /&gt;
Mike    &lt;A href="mailto:Mike@abc.com"&gt;Mike@abc.com&lt;/A&gt;                       suiyeworuiweourwqoerw &lt;/P&gt;

&lt;P&gt;And I want to use command "sendmail" to send email to each user and the message is the content value. But looks like only the first user "Jack" can receive the email, Mike can't. Can you please shed a light, how to  send email to multi users one by one?&lt;/P&gt;

&lt;P&gt;sendemail to=$result.user_email$ from="&lt;A href="mailto:boos@abc.com"&gt;boos@abc.com&lt;/A&gt;" subject="This is testing!" message="Hi, it's your content $result.content$." sendresults=true inline=true format=raw&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 00:34:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-multi-users-one-by-one/m-p/349024#M175218</guid>
      <dc:creator>chlily</dc:creator>
      <dc:date>2017-03-09T00:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to send email to multi users one by one</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-multi-users-one-by-one/m-p/349025#M175219</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>Thu, 09 Mar 2017 00:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-send-email-to-multi-users-one-by-one/m-p/349025#M175219</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-09T00:46:04Z</dc:date>
    </item>
  </channel>
</rss>

