I've integrated the MvcMailer into our project and it works perfectly. Our project is based on the Sitecore CMS where the author can create multiple mail items with different content. For each template he enters a text for the html mail and one for the text mail. For all of these mails a have one single Mailer/Action. Now, my problem is, that I have the following cases:
Both content blocks (html and text) are filled in -> send multipart mail with both parts
Only text block is filled in -> only send text mail
Only html block is filled in -> only send html mail
But currently it sends the mail based on if the views exists or not (in my case, html and text views exist, because I decide at runtime which mail part to send). With the following code I could fullfill this requirement:
public override bool TextViewExists(string viewName, string masterName)
{
if (!this.hasTextPart)
return false;
return base.TextViewExists(viewName, masterName);
}
public override bool HtmlViewExists(string viewName, string masterName)
{
if (!this.hashtmlPart)
return false;
return base.HtmlViewExists(viewName, masterName);
}
The "hasTextPart" and "hasHtmlPart" i set in my Action before calling the "Populate" method.
This isn't very nice and does not handle multiple actions, concurrency etc. Is there a better way for doing this? Is there a way out of the box and I didn't found it?
Hi,
I've integrated the MvcMailer into our project and it works perfectly. Our project is based on the Sitecore CMS where the author can create multiple mail items with different content. For each template he enters a text for the html mail and one for the text mail. For all of these mails a have one single Mailer/Action. Now, my problem is, that I have the following cases:
But currently it sends the mail based on if the views exists or not (in my case, html and text views exist, because I decide at runtime which mail part to send). With the following code I could fullfill this requirement:
The "hasTextPart" and "hasHtmlPart" i set in my Action before calling the "Populate" method.
This isn't very nice and does not handle multiple actions, concurrency etc. Is there a better way for doing this? Is there a way out of the box and I didn't found it?
Thanks and best regards, Kevin