<?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: Sendemail unexplained error: &amp;quot;command=&amp;quot;sendemail&amp;quot;, {} while sending mail to:&amp;quot; in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500143#M8009</link>
    <description>&lt;P&gt;There is no mention of sendemail in splunkd.log &lt;CODE&gt;cat splunkd.log | grep sendemail&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I believe you wanted to say search.log, I opened the file on my browser, I have +300 mention of sendemail and +1400 mention of error, the file is huge (production environment) and navigating it though the browser is not possible, can you please tell me where is this file located in Splunk folder?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2020 14:25:45 GMT</pubDate>
    <dc:creator>xZinou</dc:creator>
    <dc:date>2020-02-03T14:25:45Z</dc:date>
    <item>
      <title>Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500141#M8007</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've been trying to send emails automatically to receipients from search results, below my code :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| eval email_footer=" "
| eval email_subject="Alert something"
| eval email_message="Dear colleague,

We received an IT alert regarding something.

Should you have any question, please contact us.

Best regards.

"

| map search="sendemail server="smtp.company.com" from="noreply@company.com" to="$BusinessEmail$" footer="$email_footer$" subject="$email_subject$" message="$email_message$""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm facing a number of anomalies with this :&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;My search works randomly (last time I tried I was getting 2 successful attempts out of 5).&lt;/LI&gt;
&lt;LI&gt;Hardcoding the "to" for testing does make the sendemail work but this shows an empty email (at least $email_message$ not taken into consideration if not $email_footer$ too).&lt;/LI&gt;
&lt;LI&gt;When the search fails, the error I get is: &lt;CODE&gt;command="sendemail", {} while sending mail to:&lt;/CODE&gt; with no receipient address nor details on why it failed. I have also tried other variables for recipient but with no success.&lt;/LI&gt;
&lt;LI&gt;Using sendemail directly without map has same effects.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Any help or leads to troobleshoot this would be appreciated, I'm having difficulties finding answers on the search.log file.&lt;/P&gt;

&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500141#M8007</guid>
      <dc:creator>xZinou</dc:creator>
      <dc:date>2020-09-30T03:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500142#M8008</link>
      <description>&lt;P&gt;Have you searched for "sendemail" in splunkd.log?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500142#M8008</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-02-03T14:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500143#M8009</link>
      <description>&lt;P&gt;There is no mention of sendemail in splunkd.log &lt;CODE&gt;cat splunkd.log | grep sendemail&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I believe you wanted to say search.log, I opened the file on my browser, I have +300 mention of sendemail and +1400 mention of error, the file is huge (production environment) and navigating it though the browser is not possible, can you please tell me where is this file located in Splunk folder?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:25:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500143#M8009</guid>
      <dc:creator>xZinou</dc:creator>
      <dc:date>2020-02-03T14:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500144#M8010</link>
      <description>&lt;P&gt;If you don't find "sendemail" in splunkd.log try searching &lt;CODE&gt;index=_internal&lt;/CODE&gt;.&lt;BR /&gt;
Search logs are in the dispatch directories for the respective searches.  Start in $SPLUNK_HOME/var/run/dispatch then look for the search ID of the problem search(es).&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 15:24:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500144#M8010</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-02-03T15:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500145#M8011</link>
      <description>&lt;P&gt;Thank you, below what I have found:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;02-03-2020 15:08:29.386 INFO  script - Invoked script sendemail with 544 input bytes (0 events).  Returned 35 output bytes in 9786 ms.
02-03-2020 15:08:29.386 DEBUG SearchResultsCSVSerializer - Head from csv file read: inds.size() = 1
02-03-2020 15:08:29.386 DEBUG script - elapsed output: 1
02-03-2020 15:08:29.386 ERROR script - sid:subsearch_1580738823.39971_1580738899.4 command="sendemail", {} while sending mail to:
02-03-2020 15:08:29.386 DEBUG SearchProcessor - execute_dispatch - Post-execute - processor="sendemail" type="SP_REPORT" results_estimate_heap_usage=0 results_size=0
02-03-2020 15:08:29.386 DEBUG SearchResultsFiles - fmt=srs
02-03-2020 15:08:29.386 DEBUG SearchResultsFiles - alg=gzip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the same error displayed in Splunk web, I see no extra information here.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 16:27:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500145#M8011</guid>
      <dc:creator>xZinou</dc:creator>
      <dc:date>2020-02-03T16:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500146#M8012</link>
      <description>&lt;P&gt;What is your search using the sendemail command? I find a bit more luck with that that attempting to map.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 04:29:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500146#M8012</guid>
      <dc:creator>begleyj1</dc:creator>
      <dc:date>2020-02-04T04:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500147#M8013</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Thank for your comment. &lt;BR /&gt;
I search in email logs people that received an email from certain domains. since the search returns multiple rows, I should loop on the results to send an email to each of the receipient.&lt;BR /&gt;
I am not aware of other means to achieve this without the use of &lt;CODE&gt;map&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 08:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500147#M8013</guid>
      <dc:creator>xZinou</dc:creator>
      <dc:date>2020-02-04T08:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sendemail unexplained error: "command="sendemail", {} while sending mail to:"</title>
      <link>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500148#M8014</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Apparently, there was no way to find more information about this because sendemail command uses an external Python script that was returning:  &lt;CODE&gt;command="sendemail", {} while sending mail to:&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Since the error wasn't mentioning the recipient address, I figured out that the value in the  &lt;CODE&gt;BusinessEmail&lt;/CODE&gt; field has "formatting issues". I tried another fields and also rebuilding this one through different evals but nothing helped.&lt;/P&gt;

&lt;P&gt;Finally, using  &lt;CODE&gt;table&lt;/CODE&gt; fixed the issue, I made every  &lt;CODE&gt;$&amp;lt;field&amp;gt;$&lt;/CODE&gt; used in sendemail into a table before calling sendemail :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table BusinessEmail, email_footer, email_subject, email_message
| map search="sendemail server="smtp.company.com" from="noreply@company.com" to="$BusinessEmail$" footer="$email_footer$" subject="$email_subject$" message="$email_message$""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem I was having is now reproducible, each time I remove  &lt;CODE&gt;table&lt;/CODE&gt; it reappeares, I'm not sure how many people is facing this and I wonder maybe this should be mentioned in the Sendemail command documentation.&lt;/P&gt;

&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 10:56:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Sendemail-unexplained-error-quot-command-quot-sendemail-quot/m-p/500148#M8014</guid>
      <dc:creator>xZinou</dc:creator>
      <dc:date>2020-02-04T10:56:02Z</dc:date>
    </item>
  </channel>
</rss>

