Пример #1
0
        private string GetBodyInternal(EmailFormat format)
        {
            var markdown = $@"_User {FromAddress.DisplayName} <{FromAddress.Address}> sends the following message to the owners of Package '[{Package.PackageRegistration.Id} {Package.Version}]({PackageUrl})'._

{HtmlEncodedMessage}";

            string body;

            switch (format)
            {
            case EmailFormat.PlainText:
                body = ToPlainText(markdown);
                break;

            case EmailFormat.Markdown:
                body = markdown;
                break;

            case EmailFormat.Html:
                body = Markdown.ToHtml(markdown);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(format));
            }

            return(body + EmailMessageFooter.ForContactOwnerNotifications(format, _configuration.GalleryOwner.DisplayName, EmailSettingsUrl));
        }
        private string GetBodyInternal(EmailFormat format)
        {
            var warningMessages = GetWarningMessages();

            var markdown = $@"The symbol package [{_symbolPackage.Id} {_symbolPackage.Version}]({_packageUrl}) was recently published on {_configuration.GalleryOwner.DisplayName} by {_symbolPackage.Package.User.Username}. If this was not intended, please [contact support]({_packageSupportUrl}).";

            if (!string.IsNullOrEmpty(warningMessages))
            {
                markdown += warningMessages;
            }

            string body;

            switch (format)
            {
            case EmailFormat.PlainText:
                body = ToPlainText(markdown);
                break;

            case EmailFormat.Markdown:
                body = markdown;
                break;

            case EmailFormat.Html:
                body = Markdown.ToHtml(markdown);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(format));
            }

            return(body + EmailMessageFooter.ForPackageOwnerNotifications(format, _configuration.GalleryOwner.DisplayName, _emailSettingsUrl));
        }