Beispiel #1
0
 /// <summary>
 /// Make a request to send an email through SendGrid asynchronously.
 /// </summary>
 /// <param name="msg">A SendGridMessage object with the details for the request.</param>
 /// <param name="cancellationToken">Cancel the asynchronous call.</param>
 /// <returns>A Response object.</returns>
 public async Task <Response> SendEmailAsync(SendGridMessage msg, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await this.RequestAsync(
                Method.POST,
                msg.Serialize(),
                urlPath : "mail/send",
                cancellationToken : cancellationToken).ConfigureAwait(false));
 }
        /// <summary>
        /// Make a request to send an email through SendGrid asychronously.
        /// </summary>
        /// <param name="msg">A SendGridMessage object with the details for the request.</param>
        /// <param name="cancellationToken">Cancel the asychronous call.</param>
        /// <returns>A Response object.</returns>
        public async Task <Response> SendEmailAsync(SendGridMessage msg, CancellationToken cancellationToken = default(CancellationToken))
        {
            var serializedMessage = msg.Serialize();

            // check content for secrets
            msg.Contents.ForEach(content => contentVerifier.VerifyString(content.Value));

            return(await RequestAsync(
                       Method.POST,
                       serializedMessage,
                       urlPath : "mail/send",
                       cancellationToken : cancellationToken).ConfigureAwait(false));
        }