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
- 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**:
178
+
- SendAsync method returns EmailSendOperation that returns "Succeeded" EmailSendStatus if email is out for delivery and throws an exception otherwise. Add this code to the end of `Main` method in **Program.cs**:
Console.WriteLine($"We have timed out while polling for email status");
285
-
}
286
271
}
287
272
catch (RequestFailedExceptionex)
288
273
{
289
-
Console.WriteLine($"Email send operation failed with error code: {ex.ErrorCode}, message: {ex.Message}");
274
+
Console.WriteLine($"Email send failed with Code = {ex.ErrorCode} and Message = {ex.Message}");
290
275
}
276
+
277
+
/// Get the OperationId so that it can be used for tracking the message for troubleshooting
278
+
stringoperationId=emailSendOperation.Id;
279
+
Console.WriteLine($"Email operation id = {operationId}");
291
280
```
292
281
293
282
@@ -304,64 +293,56 @@ You can download the sample app from [GitHub](https://github.com/Azure-Samples/c
304
293
305
294
### Send an email message using the object model to construct the email payload
306
295
307
-
- Construct the email content and body using EmailContent.
296
+
- Construct the email subject and body using EmailContent.
308
297
- Add Recipients.
309
298
- Set email importance through custom headers.
310
299
- Construct your email message using your sender email address, defined in the MailFrom list of the domain linked in your Communication Services Resource.
311
300
- Include your EmailContent and EmailRecipients, optionally adding attachments.
312
301
313
302
```csharp
314
-
315
-
EmailContentemailContent=newEmailContent("Welcome to Azure Communication Service Email APIs.");
316
-
317
303
varsubject="Welcome to Azure Communication Service Email APIs.";
318
-
319
304
varemailContent=newEmailContent(subject)
320
305
{
321
-
PlainText="This email message is sent from Azure Communication Service Email using .NET SDK.",
322
-
Html="<html><body><h1>Quick send email test</h1><br/><h4>This email message is sent from Azure Communication Service Email using .NET SDK.</h4></body></html>"
306
+
PlainText="This email message is sent from Azure Communication Service Email using .NET SDK.",
307
+
Html="<html><body><h1>Quick send email test</h1><br/><h4>This email message is sent from Azure Communication Service Email using .NET SDK.</h4></body></html>"
0 commit comments