public void GetMessageStatus_InvalidMessageId() { EmailClient emailClient = CreateEmailClient(); if (IsAsync) { Assert.ThrowsAsync <ArgumentException>(async() => await emailClient.GetSendStatusAsync(string.Empty)); Assert.ThrowsAsync <ArgumentException>(async() => await emailClient.GetSendStatusAsync(null)); } else { Assert.Throws <ArgumentException>(() => emailClient.GetSendStatus(string.Empty)); Assert.Throws <ArgumentException>(() => emailClient.GetSendStatus(null)); } }
public void GetSendEmailStatus() { EmailClient client = CreateEmailClient(); // Create the email content var emailContent = new EmailContent("This is the subject"); emailContent.PlainText = "This is the body"; // Create the recipient list var emailRecipients = new EmailRecipients( new List <EmailAddress> { new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name") }); // Create the EmailMessage var emailMessage = new EmailMessage( //@@ sender: "<Send email address>" // The email address of the domain registered with the Communication Services resource /*@@*/ sender: TestEnvironment.AzureManagedFromEmailAddress, emailContent, emailRecipients); #region Snippet:Azure_Communication_Email_GetSendStatus SendEmailResult sendResult = client.Send(emailMessage); SendStatusResult status = client.GetSendStatus(sendResult.MessageId); #endregion Snippet:Azure_Communication_Email_GetSendStatus Assert.False(string.IsNullOrEmpty(sendResult.MessageId)); }
public void GetSendStatus() { EmailClient emailClient = CreateEmailClient(); SendEmailResult response = SendEmail(emailClient); Assert.IsNotNull(response); Assert.IsFalse(string.IsNullOrWhiteSpace(response.MessageId)); Console.WriteLine($"MessageId={response.MessageId}"); SendStatusResult messageStatusResponse = emailClient.GetSendStatus(response.MessageId); Assert.IsNotNull(messageStatusResponse); Console.WriteLine(messageStatusResponse.Status); }