class_docstr: Handle all alert dispatching for AWS SES
class_docstr_tok: ["Handle","all","alert","dispatching","for","AWS","SES"]
docstr: Construct the email to be sent using the alert, publication and creds
  
  Args:
    alert (Alert): The alert
    publication (dict): Alert relevant to the triggered rule
    creds (dict): Information relevant to send the alert
  
  Returns:
    msg (MIMEMultipart): The constructed email ready to be sent
code: def _build_email(cls, alert, publication, creds):
      """Construct the email to be sent using the alert, publication and creds
  
      Args:
        alert (Alert): The alert
        publication (dict): Alert relevant to the triggered rule
        creds (dict): Information relevant to send the alert
  
      Returns:
        msg (MIMEMultipart): The constructed email ready to be sent
      """
  
      # Presentation defaults
      default_subject = "{} triggered alert {}".format(
          alert.rule_name, alert.alert_id
      )
      default_body = "Please review the attached record.json"
  
      # Presentation values
      subject = publication.get("@aws-ses.subject", default_subject)
      body = publication.get("@aws-ses.body", default_body)
  
      msg = MIMEMultipart("mixed")
  
      # Setup to, from and subject
      msg["To"] = creds["to_emails"]
      msg["From"] = creds["from_email"]
      msg["Subject"] = subject
  
      # Attach the record to the email
      if publication.get("@aws-ses.attach_record", True):
          record = json.dumps(alert.record, sort_keys=True, indent=2)
          msg = cls._add_attachment(msg, "record.json", record)
  
      # Attach additional attachments to the email
      if "@aws-ses.attachments" in publication:
          for name, content in publication[
              "@aws-ses.attachments"
          ].items():
              msg = cls._add_attachment(msg, name, content)
  
      # Attach the body and return
      return cls._construct_body(msg, body)
  
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 3 for calling the SESOutput obj's underlying member method code with example usage: obj._build_email(cls, alert, publication, creds) and returns: cls