<?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 Unable to send email using 'sendemail' command in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Unable-to-send-email-using-sendemail-command/m-p/415161#M1343</link>
    <description>&lt;P&gt;I'm trying to use the Splunk CLI to send out an email using the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/opt/splunk/bin/splunk search "host=192.168.0.173 source="/var/log/secure" for * from * earliest=-59m latest=now | sendemail to="jared99@gmail.com" format="html" server=smtp.gmail.com:587 use_tls=1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tested the first part of the command (before the '|' pipe) and it definitely works. However, it seems like no email is actually being sent. &lt;/P&gt;

&lt;P&gt;Upon inspecting /opt/splunk/var/log/splunk/python.log, I see the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-01-21 16:55:37,975 +0800 ERROR     sendemail:1341 - 'action.email.sendresults'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Inspecting /opt/splunk/etc/apps/search/bin/sendemail.py only reveals that the region around line number 1341 contains the following code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 1326  def getAlertActions(sessionKey):
  1327      settings = None
  1328      try:
  1329          settings = entity.getEntity('/configs/conf-alert_actions', 'email', sessionKey=sessionKey)
  1330
  1331          logger.debug("sendemail.getAlertActions conf file settings %s" % settings)
  1332      except Exception as e:
  1333          logger.error("Could not access or parse email stanza of alert_actions.conf. Error=%s" % str(e))
  1334
  1335      return settings
  1336
  1337  results, dummyresults, settings = splunk.Intersplunk.getOrganizedResults()
  1338  try:
  1339      results = sendEmail(results, settings)
  1340  except Exception, e:
  1341      logger.error(e)
  1342  splunk.Intersplunk.outputResults(results)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would appreciate if anyone could shed some light on how to get this working. Many thanks in advance! &lt;/P&gt;</description>
    <pubDate>Mon, 21 Jan 2019 09:03:45 GMT</pubDate>
    <dc:creator>jaredloo</dc:creator>
    <dc:date>2019-01-21T09:03:45Z</dc:date>
    <item>
      <title>Unable to send email using 'sendemail' command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Unable-to-send-email-using-sendemail-command/m-p/415161#M1343</link>
      <description>&lt;P&gt;I'm trying to use the Splunk CLI to send out an email using the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/opt/splunk/bin/splunk search "host=192.168.0.173 source="/var/log/secure" for * from * earliest=-59m latest=now | sendemail to="jared99@gmail.com" format="html" server=smtp.gmail.com:587 use_tls=1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tested the first part of the command (before the '|' pipe) and it definitely works. However, it seems like no email is actually being sent. &lt;/P&gt;

&lt;P&gt;Upon inspecting /opt/splunk/var/log/splunk/python.log, I see the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-01-21 16:55:37,975 +0800 ERROR     sendemail:1341 - 'action.email.sendresults'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Inspecting /opt/splunk/etc/apps/search/bin/sendemail.py only reveals that the region around line number 1341 contains the following code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 1326  def getAlertActions(sessionKey):
  1327      settings = None
  1328      try:
  1329          settings = entity.getEntity('/configs/conf-alert_actions', 'email', sessionKey=sessionKey)
  1330
  1331          logger.debug("sendemail.getAlertActions conf file settings %s" % settings)
  1332      except Exception as e:
  1333          logger.error("Could not access or parse email stanza of alert_actions.conf. Error=%s" % str(e))
  1334
  1335      return settings
  1336
  1337  results, dummyresults, settings = splunk.Intersplunk.getOrganizedResults()
  1338  try:
  1339      results = sendEmail(results, settings)
  1340  except Exception, e:
  1341      logger.error(e)
  1342  splunk.Intersplunk.outputResults(results)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would appreciate if anyone could shed some light on how to get this working. Many thanks in advance! &lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 09:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Unable-to-send-email-using-sendemail-command/m-p/415161#M1343</guid>
      <dc:creator>jaredloo</dc:creator>
      <dc:date>2019-01-21T09:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to send email using 'sendemail' command</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Unable-to-send-email-using-sendemail-command/m-p/415162#M1344</link>
      <description>&lt;P&gt;You should find more details in splunkd.log and in the search log (via Job Inspector).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 14:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Unable-to-send-email-using-sendemail-command/m-p/415162#M1344</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-21T14:45:39Z</dc:date>
    </item>
  </channel>
</rss>

