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

# send a mail



## OpenAPI

````yaml /spec/mail.yaml post /api/v1/mails/{mailServerID}/messages
openapi: 3.0.1
info:
  title: Liara Mail API Documentaion
  description: |-
    A fully featured mail delivery platform for incoming & outgoing e-mail

    Parameters:
    - `teamID`: To access services in a team
  contact:
    name: liara
    url: https://liara.ir
    email: support@liara.ir
  version: 1.0.0
servers:
  - url: https://mail-service.iran.liara.ir
security:
  - jwt: []
tags:
  - name: mails
    description: Everything about your mails
  - name: inboundrules
    description: Email address (or domain) that you would like to block from sending.
  - name: smtp
    description: SMTP endpoints.
  - name: accounts
    description: Accounts of your mails.
  - name: messages
    description: Messages endpoints.
  - name: forward
    description: Forward endpoints.
  - name: attachments
    description: Attachments endpoints.
  - name: event
    description: Event endpoints.
  - name: tags
    description: Tags endpoints.
  - name: plan
    description: Plan endpoints.
externalDocs:
  description: Find out more about Liara Mail Server
  url: https://docs.liara.ir/email/create-mail-server/
paths:
  /api/v1/mails/{mailServerID}/messages:
    post:
      tags:
        - messages
      summary: send a mail
      operationId: sendMail
      parameters:
        - name: mailServerID
          in: path
          required: true
          schema:
            pattern: ^[0-9a-fA-F]{24}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model3'
        required: false
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
        '400':
          description: Bad Request
          content: {}
        '403':
          description: No valid dns records exists for this mail server
          content: {}
        '404':
          description: Mail Server not found
          content: {}
        '406':
          description: The source and destination addresses must not be the same
          content: {}
        '429':
          description: Too mnay requests
          content: {}
        '500':
          description: Unexpected error
          content: {}
components:
  schemas:
    Model3:
      required:
        - from
        - subject
        - to
      type: object
      properties:
        html:
          type: string
        text:
          type: string
        subject:
          type: string
        to:
          type: string
          x-convert:
            case: lower
        from:
          type: string
          x-convert:
            case: lower
        replyTo:
          type: string
        attachments:
          $ref: '#/components/schemas/attachments'
    attachments:
      maxItems: 10
      type: array
      items:
        $ref: '#/components/schemas/Model2'
    Model2:
      required:
        - content_type
        - data
        - name
      type: object
      properties:
        name:
          type: string
        content_type:
          type: string
        data:
          type: string
  securitySchemes:
    jwt:
      type: apiKey
      description: 'Enter the token with the `Bearer: ` prefix, e.g. "Bearer abcde12345".  #'
      name: Authorization
      in: header

````