> ## Documentation Index
> Fetch the complete documentation index at: https://docs.samplehc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send email

> Processes and dispatches an email. Supports plain text and encrypted emails. Attachments can be provided by ID, optionally zipped together before sending. Encrypted emails are stored and a notification link is sent.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/communication/send-email
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/communication/send-email:
    post:
      tags:
        - Communication
      summary: Send email
      description: >-
        Processes and dispatches an email. Supports plain text and encrypted
        emails. Attachments can be provided by ID, optionally zipped together
        before sending. Encrypted emails are stored and a notification link is
        sent.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                from:
                  type: string
                  description: The email address of the sender
                  default: Sample Healthcare Notifications <notifications@samplehc.com>
                to:
                  type: string
                  description: The email address of the recipient
                subject:
                  type: string
                  description: The subject line of the email
                body:
                  type: string
                  description: The main content/body of the email
                attachments:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                    required:
                      - id
                    additionalProperties: false
                  default: []
                  description: >-
                    Optional array of file attachment IDs to include with the
                    email
                zipAttachments:
                  type: boolean
                  default: false
                  description: >-
                    Whether to compress all attachments into a single zip file
                    before sending
                enableEncryption:
                  type: boolean
                  default: false
                  description: >-
                    Whether to encrypt the email content and send a secure link
                    instead. Note that encrypted emails do not support
                    attachments.
                attachAsFiles:
                  type: boolean
                  default: false
                  description: >-
                    When true, files are attached directly to the email instead
                    of as links in the body. By default, files are sent as links
                    in the body that require authentication with a Sample
                    account, but files attached directly will not require
                    authentication. This is useful for recipients without system
                    access.
              required:
                - to
                - subject
                - body
              additionalProperties: false
        required: true
      responses:
        '200':
          description: >-
            Indicates the email request was accepted and processed (or queued
            for processing).
          content:
            application/json:
              schema:
                type: object
                properties:
                  attachments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        fileName:
                          type: string
                      required:
                        - id
                        - fileName
                      additionalProperties: false
                    description: >-
                      The attachments that were sent with the email. If
                      zipAttachments was true, this will contain the single
                      zipped file.
                required:
                  - attachments
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: The error message.
                  message:
                    type: string
                    description: The message.
                  statusCode:
                    type: number
                    description: The status code.
                  details:
                    type: object
                    additionalProperties: {}
                    description: The details of the error
                additionalProperties: true
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: >-
                      Indicates an unexpected internal server error occurred
                      while trying to send the email.
                required:
                  - error
                additionalProperties: false
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from samplehc import SampleHealthcare

            client = SampleHealthcare(
                api_key=os.environ.get("SAMPLEHC_API_KEY"),  # This is the default and can be omitted
            )
            response = client.v2.communication.send_email(
                body="body",
                subject="subject",
                to="to",
            )
            print(response.attachments)

````