/// <summary>
        /// The create.
        /// </summary>
        /// <returns>
        /// The <see cref="SendGridMessageBuilder"/>.
        /// </returns>
        public static SendGridMessageBuilder Create()
        {
            var mailBuilder = new SendGridMessageBuilder();

            mailBuilder.sendgrid = new SendGridMessage();
            return(mailBuilder);
        }
コード例 #2
0
        private SendGridMessageBuilder BuildBaseEmail(EmailMessage message)
        {
            return(SendGridMessageBuilder.Create()
                   .To(message.To)
                   .From(this.emailConfig.FromAddress, this.emailConfig.FromDisplayName)
                   .Subject(message.Subject)
                   .HtmlBody(message.Body ?? string.Empty));

            // classic way, without external builder helper

            /*
             * string emailFrom = this.emailConfig.FromAddress;
             *
             * var email = new SendGridMessage();
             *
             * email.AddTo(message.To);
             * email.From = new System.Net.Mail.MailAddress(emailFrom, this.emailConfig.FromDisplayName);
             * email.Subject = message.Subject;
             *
             * email.Html = message.Body ?? string.Empty;
             *
             * email.DisableClickTracking();
             * return email;
             */
        }