<?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 use the sendemail command to send results to different emails created with eval? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277615#M83731</link>
    <description>&lt;P&gt;It's a good way but I still have one problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my search | stats count(filename) AS files, sum(size) AS TotalMb by user| sort -TotalMb |  eval email=user."@mydomai.com" 
| table user, files, TotalMb, email | head 2 
| sendemail  to=$email$ from=$splunk@mydomain.com$ subject="Big files" sendresults=true inline=true priority=normal server="mail.server" message="TEST"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result is emailed for each user with the same table:&lt;BR /&gt;
1 user1, 123, 506Mb, &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
2 user2, 234, 26Mb, &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But I need a separate email:&lt;BR /&gt;
Email1 to &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
1 user1, 123, 506Mb, &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
Email2 to &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;BR /&gt;
2 user2, 234, 26Mb, &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I have tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| map search="sendemail  to=$email$ from=$splunk@mydomain.com$ subject="Big files" sendresults=true inline=true priority=normal server="mail.server" message="TEST""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but each user receives email with "No results found"&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 12:08:51 GMT</pubDate>
    <dc:creator>kalianov</dc:creator>
    <dc:date>2016-04-08T12:08:51Z</dc:date>
    <item>
      <title>How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277612#M83728</link>
      <description>&lt;P&gt;Hi splunkers !!! Need help.&lt;/P&gt;

&lt;P&gt;I used eval to create a field with the email address for some users:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search myquery.... | fields username, result | eval mail=username+"@mydomain.com"
|sendemail to=mail subject="Splunk is wathing you" sendresults=true
inline=true priority=normal
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it's not working.&lt;/P&gt;

&lt;P&gt;In python.log&lt;BR /&gt;
I want to send emails for all users from my search with specific results for every username from the search.&lt;BR /&gt;
Is it possible?  Can I use "mail" field like variable?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 09:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277612#M83728</guid>
      <dc:creator>kalianov</dc:creator>
      <dc:date>2016-04-07T09:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277613#M83729</link>
      <description>&lt;P&gt;Have you tried: &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/186045/how-can-i-use-a-combination-of-map-and-sendemail-t.html"&gt;https://answers.splunk.com/answers/186045/how-can-i-use-a-combination-of-map-and-sendemail-t.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/213340/how-to-get-splunk-sendemail-command-to-send-multip.html"&gt;https://answers.splunk.com/answers/213340/how-to-get-splunk-sendemail-command-to-send-multip.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 10:31:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277613#M83729</guid>
      <dc:creator>mcronkrite</dc:creator>
      <dc:date>2016-04-07T10:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277614#M83730</link>
      <description>&lt;P&gt;As a test, configure your Search Head to use gmail like this:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://blogs.splunk.com/2014/06/27/splunk-alerts-using-gmail-twitter-phone-calls-and-much-more/"&gt;http://blogs.splunk.com/2014/06/27/splunk-alerts-using-gmail-twitter-phone-calls-and-much-more/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 15:30:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277614#M83730</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-07T15:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277615#M83731</link>
      <description>&lt;P&gt;It's a good way but I still have one problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my search | stats count(filename) AS files, sum(size) AS TotalMb by user| sort -TotalMb |  eval email=user."@mydomai.com" 
| table user, files, TotalMb, email | head 2 
| sendemail  to=$email$ from=$splunk@mydomain.com$ subject="Big files" sendresults=true inline=true priority=normal server="mail.server" message="TEST"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result is emailed for each user with the same table:&lt;BR /&gt;
1 user1, 123, 506Mb, &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
2 user2, 234, 26Mb, &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But I need a separate email:&lt;BR /&gt;
Email1 to &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
1 user1, 123, 506Mb, &lt;A href="mailto:user1@mydomai.com"&gt;user1@mydomai.com&lt;/A&gt;&lt;BR /&gt;
Email2 to &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;BR /&gt;
2 user2, 234, 26Mb, &lt;A href="mailto:user2@mydomai.com"&gt;user2@mydomai.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I have tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| map search="sendemail  to=$email$ from=$splunk@mydomain.com$ subject="Big files" sendresults=true inline=true priority=normal server="mail.server" message="TEST""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but each user receives email with "No results found"&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 12:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277615#M83731</guid>
      <dc:creator>kalianov</dc:creator>
      <dc:date>2016-04-08T12:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277616#M83732</link>
      <description>&lt;P&gt;I must to use internal email server&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2016 14:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277616#M83732</guid>
      <dc:creator>kalianov</dc:creator>
      <dc:date>2016-04-12T14:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277617#M83733</link>
      <description>&lt;P&gt;Did you ever get this to work?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 18:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/277617#M83733</guid>
      <dc:creator>afarmer</dc:creator>
      <dc:date>2017-12-05T18:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the sendemail command to send results to different emails created with eval?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/557755#M158411</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:36:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-sendemail-command-to-send-results-to-different/m-p/557755#M158411</guid>
      <dc:creator>sirajnp</dc:creator>
      <dc:date>2021-06-30T07:36:46Z</dc:date>
    </item>
  </channel>
</rss>

