You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/email/includes/send-email-java.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ EmailSendResult returns the following status on the email operation performed.
47
47
48
48
Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
49
49
50
-
> [!Note]
50
+
> [!NOTE]
51
51
> We can also send an email from our own verified domain [Add custom verified domains to Email Communication Service](../add-custom-verified-domains.md).
52
52
53
53
### Prerequisite check
@@ -117,35 +117,34 @@ EmailClient emailClient = new EmailClientBuilder()
117
117
.buildClient();
118
118
```
119
119
120
-
### Option 2: Authenticate using an AzureKeyCredential
120
+
### Option 2: Authenticate using Azure Active Directory
121
121
122
-
Email clients can also be created and authenticated using the endpoint and Azure Key Credential acquired from an Azure Communication Resource in the [Azure portal](https://portal.azure.com/).
122
+
A `DefaultAzureCredential` object must be passed to the `EmailClientBuilder` via the `credential()` method. An endpoint must also be set via the `endpoint()` method.
123
+
124
+
The `AZURE_CLIENT_SECRET`, `AZURE_CLIENT_ID`, and `AZURE_TENANT_ID` environment variables are needed to create a `DefaultAzureCredential` object.
### Option 3: Authenticate using Azure Active Directory
135
+
### Option 3: Authenticate using AzureKeyCredential
134
136
135
-
A `DefaultAzureCredential` object must be passed to the `EmailClientBuilder` via the `credential()` method. An endpoint must also be set via the `endpoint()` method.
136
-
137
-
The `AZURE_CLIENT_SECRET`, `AZURE_CLIENT_ID`, and `AZURE_TENANT_ID` environment variables are needed to create a `DefaultAzureCredential` object.
137
+
Email clients can also be created and authenticated using the endpoint and Azure Key Credential acquired from an Azure Communication Resource in the [Azure portal](https://portal.azure.com/).
138
138
139
139
```java
140
-
// You can find your endpoint and access key from your resource in the Azure portal
For simplicity, this quickstart uses connection strings, but in production environments, we recommend using [service principals](../../../quickstarts/identity/service-principal.md).
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/email/includes/send-email-js.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ EmailSendResult returns the following status on the email operation performed.
49
49
50
50
Completing this quick start incurs a small cost of a few USD cents or less in your Azure account.
51
51
52
-
> [!Note]
52
+
> [!NOTE]
53
53
> We can also send an email from our own verified domain. [Add custom verified domains to Email Communication Service](../add-azure-managed-domains.md).
54
54
55
55
### Prerequisite check
@@ -109,21 +109,38 @@ const emailClient = new EmailClient(connectionString);
109
109
110
110
### Option 2: Authenticate using Azure Active Directory
111
111
112
-
You can also authenticate with Azure Active Directory using the [Azure Identity library](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity). To use the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) provider shown below, or other credential providers provided with the Azure SDK, please install the [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) package:
112
+
You can also authenticate with Azure Active Directory using the [Azure Identity library](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity). To use the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) provider in the following snippet, or other credential providers provided with the Azure SDK, install the [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) package:
113
113
114
114
```bash
115
115
npm install @azure/identity
116
116
```
117
117
118
-
The [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) package provides a variety of credential types that your application can use to do this. The README for `@azure/identity` provides more details and samples to get you started.
118
+
The [`@azure/identity`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity) package provides various credential types that your application can use to authenticate. The README for `@azure/identity` provides more details and samples to get you started.
119
119
`AZURE_CLIENT_SECRET`, `AZURE_CLIENT_ID` and `AZURE_TENANT_ID` environment variables are needed to create a `DefaultAzureCredential` object.
### Option 3: Authenticate using AzureKeyCredential
132
+
133
+
Email clients can also be authenticated using an [AzureKeyCredential](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#azure.core.credentials.AzureKeyCredential). Both the `key` and the `endpoint` can be founded on the "Keys" pane under "Settings" in your Communication Services Resource.
var key =newAzureKeyCredential("<your-key-credential>");
141
+
var endpoint ="<your-endpoint-uri>";
142
+
143
+
constemailClient=newEmailClient(endpoint, key);
127
144
```
128
145
129
146
For simplicity, this quickstart uses connection strings, but in production environments, we recommend using [service principals](../../../quickstarts/identity/service-principal.md).
Get started with Azure Communication Services by using the Communication Services C# Email client library to send Email messages.
14
14
15
-
## Understanding Email Object model
15
+
## Understanding the Email Object model
16
16
17
17
The following classes and interfaces handle some of the major features of the Azure Communication Services Email Client library for C#.
18
18
@@ -39,8 +39,8 @@ EmailSendResult returns the following status on the email operation performed.
39
39
| NotStarted | We're not sending this status from our service at this time. |
40
40
| Running | The email send operation is currently in progress and being processed. |
41
41
| Succeeded | The email send operation has completed without error and the email is out for delivery. Any detailed status about the email delivery beyond this stage can be obtained either through Azure Monitor or through Azure Event Grid. [Learn how to subscribe to email events](../handle-email-events.md)|
42
-
| Failed | The email send operation was not successful and encountered an error. The email was not sent. The result will contain an error object with more details on the reason for failure or cancellation. |
43
-
| Canceled | The email send operation was canceled before it could complete. The email was not sent. The result will contain an error object with more details on the reason for failure or cancellation.|
42
+
| Failed | The email send operation wasn't successful and encountered an error. The email wasn't sent. The result contains an error object with more details on the reason for failure or cancellation. |
43
+
| Canceled | The email send operation was canceled before it could complete. The email wasn't sent. The result contains an error object with more details on the reason for failure or cancellation.|
44
44
45
45
## Prerequisites
46
46
@@ -49,13 +49,16 @@ EmailSendResult returns the following status on the email operation performed.
49
49
- An Azure Email Communication Services Resource created and ready with a provisioned domain [Get started with Creating Email Communication Resource](../create-email-communication-resource.md)
50
50
- An active Communication Services resource connected with Email Domain and a Connection String. [Get started by Connecting Email Resource with a Communication Resource](../connect-email-communication-resource.md)
51
51
52
+
Completing this quick start incurs a small cost of a few USD cents or less in your Azure account.
53
+
54
+
> [!NOTE]
55
+
> We can also send an email from our own verified domain. [Add custom verified domains to Email Communication Service](../add-azure-managed-domains.md).
56
+
52
57
### Prerequisite check
53
58
54
59
- In a terminal or command window, run the `dotnet` command to check that the .NET client library is installed.
55
60
- To view the subdomains associated with your Email Communication Services resource, sign in to the [Azure portal](https://portal.azure.com/), locate your Email Communication Services resource and open the **Provision domains** tab from the left navigation pane.
56
61
57
-
Completing this quick start incurs a small cost of a few USD cents or less in your Azure account.
58
-
59
62
### Create a new C# application
60
63
In a console window (such as cmd, PowerShell, or Bash), use the `dotnet new` command to create a new console app with the name `EmailQuickstart`. This command creates a simple "Hello World" C# project with a single source file: **Program.cs**.
61
64
@@ -108,7 +111,7 @@ namespace SendEmail
108
111
109
112
### Option 1: Authenticate using a connection string
110
113
111
-
Open **Program.cs** in a text editor and replace the body of the `Main` method with code to initialize an `EmailClient` with your connection string. The code below retrieves the connection string for the resource from an environment variable named `COMMUNICATION_SERVICES_CONNECTION_STRING`. Learn how to [manage your resource's connection string](../../create-communication-resource.md#store-your-connection-string).
114
+
Open **Program.cs** in a text editor and replace the body of the `Main` method with code to initialize an `EmailClient` with your connection string. The following code retrieves the connection string for the resource from an environment variable named `COMMUNICATION_SERVICES_CONNECTION_STRING`. Learn how to [manage your resource's connection string](../../create-communication-resource.md#store-your-connection-string).
112
115
113
116
114
117
@@ -121,7 +124,7 @@ EmailClient emailClient = new EmailClient(connectionString);
121
124
122
125
### Option 2: Authenticate using Azure Active Directory
123
126
124
-
To authenticate using Azure Active Directory, install the Azure.Identity library package for .NET by using the `dotnet add package` command.
127
+
To authenticate using Azure Active Directory, install the `Azure.Identity` library package for .NET by using the `dotnet add package` command.
### Option 3: Authenticate using AzureKeyCredential
143
+
144
+
Email clients can also be authenticated using an [AzureKeyCredential](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#azure.core.credentials.AzureKeyCredential). Both the `key` and the `endpoint` can be founded on the "Keys" pane under "Settings" in your Communication Services Resource.
- Call SendSync method which sends the email request as an asynchronous operation. Call with Azure.WaitUntil.Completed if your method should wait to return until the long-running operation has completed on the service; Call with Azure.WaitUntil.Started if your method should return after starting the operation.
164
-
- SendAsync method returns EmailSendOperation which returns "Succeeded" EmailSendStatus if email is out for delivery. Add this code to the end of `Main` method in **Program.cs**:
177
+
- Call SendSync method that sends the email request as an asynchronous operation. Call with Azure.WaitUntil.Completed if your method should wait to return until the long-running operation has completed on the service. Call with Azure.WaitUntil.Started if your method should return after starting the operation.
178
+
- SendAsync method returns EmailSendOperation that returns "Succeeded" EmailSendStatus if email is out for delivery. Add this code to the end of `Main` method in **Program.cs**:
165
179
166
180
```csharp
167
181
try
@@ -193,20 +207,20 @@ catch (Exception ex)
193
207
194
208
### Getting email delivery status
195
209
196
-
EmailSendOperation only returns email operation status. To get the actual email delivery status you can subscribe to "EmailDeliveryReportReceived" event which is generated when the email delivery is completed and the event returns the following delivery state:
210
+
EmailSendOperation only returns email operation status. To get the actual email delivery status, you can subscribe to "EmailDeliveryReportReceived" event that is generated when the email delivery is completed. The event returns the following delivery state:
197
211
198
212
- Delivered.
199
213
- Failed.
200
214
- Quarantined.
201
215
202
216
See [Handle Email Events](../handle-email-events.md) for details.
203
217
204
-
You can also now subscribe to Email Operational logs which provides information related to delivery metrics for messages sent from the Email service.
218
+
You can also now subscribe to Email Operational logs that provide information related to delivery metrics for messages sent from the Email service.
205
219
206
220
- Email Send Mail operational logs - provides detailed information related to the Email service send mail requests.
207
221
- Email Status Update operational logs - provides message and recipient level delivery status updates related to the Email service send mail requests.
208
222
209
-
Please see how to [Get started with log analytics in Azure Communication Service](../../../concepts/logging-and-diagnostics.md)
223
+
See how to [Get started with log analytics in Azure Communication Service](../../../concepts/logging-and-diagnostics.md)
210
224
211
225
### Run the code
212
226
@@ -226,8 +240,8 @@ You can download the sample app from [GitHub](https://github.com/Azure-Samples/c
226
240
227
241
When you call SendAsync with Azure.WaitUntil.Started, your method returns back after starting the operation. The method returns EmailSendOperation object. You can call UpdateStatusAsync method to refresh the email operation status.
228
242
229
-
The returned EmailSendOperation object contains an EmailSendStatus object which contains:
230
-
- Current status of the email send operation.
243
+
The returned EmailSendOperation object contains an EmailSendStatus object that contains:
244
+
- Current status of the Email Send operation.
231
245
- An error object with failure details if the current status is in a failed state.
232
246
233
247
```csharp
@@ -358,7 +372,7 @@ catch (Exception ex)
358
372
359
373
### Send an email message to multiple recipients
360
374
361
-
We can define multiple recipients by adding additional EmailAddresses to the EmailRecipients object. These addresses can be added as `To`, `CC`, or `BCC` recipients.
375
+
We can define multiple recipients by adding more EmailAddresses to the EmailRecipients object. These addresses can be added as `To`, `CC`, or `BCC` recipients.
362
376
363
377
```csharp
364
378
vartoRecipients=newList<EmailAddress>
@@ -380,7 +394,7 @@ var bccRecipients = new List<EmailAddress>
You can download the sample app demonstrating this from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/SendEmailAdvanced/SendEmailToMultipleRecipients)
397
+
You can download the sample app demonstrating this action from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/SendEmailAdvanced/SendEmailToMultipleRecipients)
You can download the sample app demonstrating this from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/SendEmailAdvanced/SendEmailWithAttachments)
414
+
You can download the sample app demonstrating this action from [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/SendEmailAdvanced/SendEmailWithAttachments)
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/email/includes/send-email-python.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,9 @@ The `response.status` values are explained further in the following table.
104
104
105
105
Completing this quick start incurs a small cost of a few USD cents or less in your Azure account.
106
106
107
+
> [!NOTE]
108
+
> We can also send an email from our own verified domain. [Add custom verified domains to Email Communication Service](../add-azure-managed-domains.md).
109
+
107
110
### Prerequisite check
108
111
- In a terminal or command window, run the `python --version` command to check that Python is installed.
109
112
- To view the domains verified with your Email Communication Services resource, sign in to the [Azure portal](https://portal.azure.com/). Locate your Email Communication Services resource and open the **Provision domains** tab from the left navigation pane.
@@ -170,18 +173,21 @@ from azure.identity import DefaultAzureCredential
170
173
171
174
# To use Azure Active Directory Authentication (DefaultAzureCredential) make sure to have AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET as env variables.
### Option 3: Authenticate using AzureKeyCredential
177
-
Email clients can also be authenticated using an [AzureKeyCredential](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#azure.core.credentials.AzureKeyCredential).
180
+
181
+
Email clients can also be authenticated using an [AzureKeyCredential](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#azure.core.credentials.AzureKeyCredential). Both the `key` and the `endpoint` can be founded on the "Keys" pane under "Settings" in your Communication Services Resource.
178
182
179
183
```python
180
184
from azure.communication.email import EmailClient
181
185
from azure.core.credentials import AzureKeyCredential
For simplicity, this quickstart uses connection strings, but in production environments, we recommend using [service principals](../../../quickstarts/identity/service-principal.md).
0 commit comments