class_docstr: Handle all alert dispatching for AWS SES
class_docstr_tok: ["Handle","all","alert","dispatching","for","AWS","SES"]
docstr: Send alert to an SES Output
  
  Publishing:
      By default the aws-ses output sends an email comprising some default intro text
      and an attachment containing:
      * alert.record (record.json)
  
      - @aws-ses.subject (str):
          Replaces the default subject
      - @aws-ses.attach_record (bool):
          True (default): Attach the alert.record to the email
          False: Don't attach the alert.record to the email
      - @aws-ses.attachments (dict):
          A dict of attachments to include in the message.
      - @aws-ses.body (str):
          Replaces the default intro text
  
          @see cls._construct_body() for some insight into how you can customize the body
  
  Args:
      alert (Alert): Alert instance which triggered a rule
      descriptor (str): Output descriptor
  
  Returns:
      bool: True if alert was sent successfully, False otherwise
code: def _dispatch(self, alert, descriptor):
      """Send alert to an SES Output
  
      Publishing:
          By default the aws-ses output sends an email comprising some default intro text
          and an attachment containing:
          * alert.record (record.json)
  
          - @aws-ses.subject (str):
              Replaces the default subject
          - @aws-ses.attach_record (bool):
              True (default): Attach the alert.record to the email
              False: Don't attach the alert.record to the email
          - @aws-ses.attachments (dict):
              A dict of attachments to include in the message.
          - @aws-ses.body (str):
              Replaces the default intro text
  
              @see cls._construct_body() for some insight into how you can customize the body
  
      Args:
          alert (Alert): Alert instance which triggered a rule
          descriptor (str): Output descriptor
  
      Returns:
          bool: True if alert was sent successfully, False otherwise
      """
      creds = self._load_creds(descriptor)
      if not creds:
          return False
  
      publication = compose_alert(alert, self, descriptor)
  
      msg = self._build_email(alert, publication, creds)
  
      ses = boto3.client("ses", region_name=self.region)
  
      try:
          response = ses.send_raw_email(
              Source=msg["From"],
              Destinations=msg["To"].split(","),
              RawMessage={"Data": msg.as_string()},
          )
      except ClientError as e:
          LOGGER.error(e.response["Error"]["Message"])
          return False
      else:
          LOGGER.info(
              "Email sent! Message ID: %s", response["MessageId"]
          )
          return True
  
imports: from abc import abstractmethod
  from collections import OrderedDict
  from email.mime.application import MIMEApplication
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  from datetime import datetime
  import json
  import uuid
  import backoff
  from botocore.exceptions import ClientError
  import boto3
  from streamalert.alert_processor.helpers import compose_alert, elide_string_middle
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher, OutputProperty, StreamAlertOutput
  from streamalert.shared.backoff_handlers import backoff_handler, success_handler, giveup_handler
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 5 for calling the SESOutput obj's underlying member method code with example usage: obj._dispatch(alert, descriptor) and returns: False, True, False