I wrote some code and realized they share similar logic. I am struggling to share the logic and welcome any suggestions.
public List<string> SendTemplateAsSampleEmail(MtaConnection mtaConnection, ICollection<EmailRecipient> recipients,
SimpleContentDto renderedContent)
{
var errorStrings = new List<string>();
// Get the list of branded values
var fromAddress = BrandingHelper.GetFromAddressForSampleEmail(_httpContextBase);
var replyToAddress = BrandingHelper.GetFromAddressForSampleEmail(_httpContextBase);
var fromName = BrandingHelper.GetBrandName(_httpContextBase);
// First send as in TGE
if (!string.IsNullOrEmpty(renderedContent.HtmlText))
{
errorStrings.AddRange(SendTransactionalEmail(mtaConnection, recipients, renderedContent.HtmlText,
HtmlSubjectPrefixAsTge + renderedContent.Subject,
fromAddress, fromName, replyToAddress,
emailDomain: "[email protected]",
preHeader: null,
contentType: EmailContentType.HtmlContent));
}
return errorStrings;
}
public List<string> SendSampleEmailForHtmlContent(MtaConnection mtaConnection, ICollection<EmailRecipient> recipients, string name,
string htmlContent, string preHeader)
{
return SendTransactionalEmail(mtaConnection, recipients, htmlContent, HtmlSubjectPrefix + name,
fromAddress: BrandingHelper.GetFromAddressForSampleEmail(_httpContextBase),
fromName: BrandingHelper.GetBrandName(_httpContextBase),
replyToAddress: BrandingHelper.GetFromAddressForSampleEmail(_httpContextBase),
emailDomain: "[email protected]", preHeader: preHeader,
contentType: EmailContentType.HtmlContent);
}
HtmlSubjectPrefix
\$\endgroup\$SendTransactionalEmail
\$\endgroup\$