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");
288
-
}
289
271
}
290
-
catch (Exceptionex)
272
+
catch (RequestFailedExceptionex)
291
273
{
292
-
Console.WriteLine($"Error in sending email, {ex}");
274
+
Console.WriteLine($"Email send failed with Code = {ex.ErrorCode} and Message = {ex.Message}");
293
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}");
294
280
```
295
281
296
282
@@ -307,65 +293,57 @@ You can download the sample app from [GitHub](https://github.com/Azure-Samples/c
307
293
308
294
### Send an email message using the object model to construct the email payload
309
295
310
-
- Construct the email content and body using EmailContent.
296
+
- Construct the email subject and body using EmailContent.
311
297
- Add Recipients.
312
298
- Set email importance through custom headers.
313
299
- Construct your email message using your sender email address, defined in the MailFrom list of the domain linked in your Communication Services Resource.
314
300
- Include your EmailContent and EmailRecipients, optionally adding attachments.
315
301
316
302
```csharp
317
-
318
-
EmailContentemailContent=newEmailContent("Welcome to Azure Communication Service Email APIs.");
319
-
320
303
varsubject="Welcome to Azure Communication Service Email APIs.";
321
-
322
304
varemailContent=newEmailContent(subject)
323
305
{
324
-
PlainText="This email message is sent from Azure Communication Service Email using .NET SDK.",
325
-
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