Email - Send

Queues an email message to be sent to one or more recipients

POST {endpoint}/emails:send?api-version=2021-10-01-preview

URI Parameters

Name In Required Type Description
endpoint
path True
  • string

The communication resource, for example https://my-resource.communication.azure.com

api-version
query True
  • string

Version of API to invoke.

Request Header

Name Required Type Description
Authorization True
  • string

An authentication string containing a signature generated using HMAC-SHA256 scheme.

repeatability-request-id True
  • string

If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs.

repeatability-first-sent True
  • string

Must be sent by clients to specify that a request is repeatable. Repeatability-First-Sent is used to specify the date and time at which the request was first created in the IMF-fix date form of HTTP-date as defined in RFC7231. eg- Tue, 26 Mar 2019 16:06:51 GMT

Request Body

Name Required Type Description
content True

Email content to be sent.

recipients True

Recipients for the email.

sender True
  • string

Sender email address from a verified domain.

attachments

list of attachments

disableUserEngagementTracking
  • boolean

Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane.

headers

Custom email headers to be passed.

importance

The importance type for the email.

replyTo

Email addresses where recipients' replies will be sent to.

Responses

Name Type Description
202 Accepted

Message accepted, the Operation-Location header contains the URL to poll for the message status.

Headers

  • Repeatability-Result: string
  • Operation-Location: string
  • Retry-After: integer
  • x-ms-request-id: string
Other Status Codes

Error

Headers

  • x-ms-error-code: string

Security

Authorization

An authentication string containing a signature generated using HMAC-SHA256 scheme.

Type: apiKey
In: header

Examples

Send Email

Sample Request

POST https://contoso.westus.communications.azure.com/emails:send?api-version=2021-10-01-preview



{
  "headers": [
    {
      "name": "ClientCorrelationId",
      "value": "123"
    },
    {
      "name": "ClientCustomHeaderName",
      "value": "ClientCustomHeaderValue"
    }
  ],
  "sender": "abc@domain.com",
  "content": {
    "subject": "An exciting offer especially for you!",
    "plainText": "This exciting offer was created especially for you, our most loyal customer.",
    "html": "<html><head><title>Exciting offer!</title></head><body><h1>This exciting offer was created especially for you, our most loyal customer.</h1></body></html>"
  },
  "importance": "normal",
  "recipients": {
    "to": [
      {
        "email": "john.doe@domain.com",
        "displayName": "John Doe"
      },
      {
        "email": "jane.doe@domain2.com",
        "displayName": "Jane Doe"
      }
    ],
    "CC": [
      {
        "email": "wendy@someotherdomain.com",
        "displayName": "Wendy"
      },
      {
        "email": "jimmy@anotherdomain.com",
        "displayName": "Jimmy Johns"
      }
    ],
    "bCC": [
      {
        "email": "bob@anotherdomain.com",
        "displayName": "Bob"
      },
      {
        "email": "mail@yetanotherdomain.com",
        "displayName": "Another DisplayName"
      }
    ]
  },
  "attachments": [
    {
      "name": "MyAttachment.pdf",
      "attachmentType": "pdf",
      "contentBytesBase64": "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu"
    },
    {
      "name": "MyAttachment2.docx",
      "attachmentType": "docx",
      "contentBytesBase64": "pZ2h0IHdvcmsu5kcyBtYWtlIGxpZ2h0IHdvcmsu"
    }
  ],
  "replyTo": [
    {
      "email": "contoso-support@contoso.com",
      "displayName": "Contoso Support"
    }
  ],
  "disableUserEngagementTracking": true
}

Sample Response

Repeatability-Result: accepted
Operation-Location: https://contoso.westus.communications.azure.com//email/status/8540c0de-899f-5cce-acb5-3ec493af3800?api-version=2021-10-01-preview
Retry-After: 1
x-ms-request-id: 8540c0de-899f-5cce-acb5-3ec493af3800

Definitions

CommunicationError

The Communication Services error.

CommunicationErrorResponse

The Communication Services error.

EmailAddress

An object representing the email address and its display name

EmailAttachment

Attachment to the email.

EmailAttachmentType

The type of attachment file.

EmailContent

Content of the email.

EmailCustomHeader

Custom header for email.

EmailImportance

The importance type for the email.

EmailMessage

Message payload for sending an email

EmailRecipients

Recipients of the email

CommunicationError

The Communication Services error.

Name Type Description
code
  • string

The error code.

details

Further details about specific errors that led to this error.

innererror

The inner error if any.

message
  • string

The error message.

target
  • string

The error target.

CommunicationErrorResponse

The Communication Services error.

Name Type Description
error

The Communication Services error.

EmailAddress

An object representing the email address and its display name

Name Type Description
displayName
  • string

Email display name.

email
  • string

Email address.

EmailAttachment

Attachment to the email.

Name Type Description
attachmentType

The type of attachment file.

contentBytesBase64
  • string

Base64 encoded contents of the attachment

name
  • string

Name of the attachment

EmailAttachmentType

The type of attachment file.

Name Type Description
avi
  • string
bmp
  • string
doc
  • string
docm
  • string
docx
  • string
gif
  • string
jpeg
  • string
mp3
  • string
one
  • string
pdf
  • string
png
  • string
ppsm
  • string
ppsx
  • string
ppt
  • string
pptm
  • string
pptx
  • string
pub
  • string
rpmsg
  • string
rtf
  • string
tif
  • string
txt
  • string
vsd
  • string
wav
  • string
wma
  • string
xls
  • string
xlsb
  • string
xlsm
  • string
xlsx
  • string

EmailContent

Content of the email.

Name Type Description
html
  • string

Html version of the email message.

plainText
  • string

Plain text version of the email message.

subject
  • string

Subject of the email message

EmailCustomHeader

Custom header for email.

Name Type Description
name
  • string

Header name.

value
  • string

Header value.

EmailImportance

The importance type for the email.

Name Type Description
high
  • string
low
  • string
normal
  • string

EmailMessage

Message payload for sending an email

Name Type Default Value Description
attachments

list of attachments

content

Email content to be sent.

disableUserEngagementTracking
  • boolean

Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane.

headers

Custom email headers to be passed.

importance normal

The importance type for the email.

recipients

Recipients for the email.

replyTo

Email addresses where recipients' replies will be sent to.

sender
  • string

Sender email address from a verified domain.

EmailRecipients

Recipients of the email

Name Type Description
CC

Email CC recipients

bCC

Email BCC recipients

to

Email To recipients