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 |
|
The communication resource, for example https://my-resource.communication.azure.com |
|
api-version
|
query | True |
|
Version of API to invoke. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Authorization | True |
|
An authentication string containing a signature generated using HMAC-SHA256 scheme. |
| repeatability-request-id | True |
|
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 |
|
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 |
|
Sender email address from a verified domain. |
| attachments |
list of attachments |
||
| disableUserEngagementTracking |
|
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 Headers
|
|
| Other Status Codes |
Error Headers
|
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
|
Communication |
The Communication Services error. |
|
Communication |
The Communication Services error. |
|
Email |
An object representing the email address and its display name |
|
Email |
Attachment to the email. |
|
Email |
The type of attachment file. |
|
Email |
Content of the email. |
|
Email |
Custom header for email. |
|
Email |
The importance type for the email. |
|
Email |
Message payload for sending an email |
|
Email |
Recipients of the email |
CommunicationError
The Communication Services error.
| Name | Type | Description |
|---|---|---|
| code |
|
The error code. |
| details |
Further details about specific errors that led to this error. |
|
| innererror |
The inner error if any. |
|
| message |
|
The error message. |
| target |
|
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 |
|
Email display name. |
|
Email address. |
EmailAttachment
Attachment to the email.
| Name | Type | Description |
|---|---|---|
| attachmentType |
The type of attachment file. |
|
| contentBytesBase64 |
|
Base64 encoded contents of the attachment |
| name |
|
Name of the attachment |
EmailAttachmentType
The type of attachment file.
| Name | Type | Description |
|---|---|---|
| avi |
|
|
| bmp |
|
|
| doc |
|
|
| docm |
|
|
| docx |
|
|
| gif |
|
|
| jpeg |
|
|
| mp3 |
|
|
| one |
|
|
|
||
| png |
|
|
| ppsm |
|
|
| ppsx |
|
|
| ppt |
|
|
| pptm |
|
|
| pptx |
|
|
| pub |
|
|
| rpmsg |
|
|
| rtf |
|
|
| tif |
|
|
| txt |
|
|
| vsd |
|
|
| wav |
|
|
| wma |
|
|
| xls |
|
|
| xlsb |
|
|
| xlsm |
|
|
| xlsx |
|
EmailContent
Content of the email.
| Name | Type | Description |
|---|---|---|
| html |
|
Html version of the email message. |
| plainText |
|
Plain text version of the email message. |
| subject |
|
Subject of the email message |
EmailCustomHeader
Custom header for email.
| Name | Type | Description |
|---|---|---|
| name |
|
Header name. |
| value |
|
Header value. |
EmailImportance
The importance type for the email.
| Name | Type | Description |
|---|---|---|
| high |
|
|
| low |
|
|
| normal |
|
EmailMessage
Message payload for sending an email
| Name | Type | Default Value | Description |
|---|---|---|---|
| attachments |
list of attachments |
||
| content |
Email content to be sent. |
||
| disableUserEngagementTracking |
|
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 |
|
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 |