Email Template field options

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
2/9/2012 4:21:50 PM
Gravatar
Total Posts 21

Email Template field options

Hi

I'm editing these two MessageTemplates-
en-US-ForumNotificationEmail.config
en-US-ForumNotificationEmailSubject.config

I was wondering if there is documentation for the available template fields? Specifically I was wondering if there's a way to get the title of the module or the page in the email.

I tried {PageName} but that does not seem to work.

Thanks,

Mike

2/9/2012 5:31:54 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Email Template field options

I took a quick tour through the source code, and each of the following tokens are being replaced in the message body and subject. So you should be able to use {ModuleName}, at least. Any additions to this list would have to be a feature request.

body.Replace("{SiteName}", notificationInfo.SiteName);
body.Replace("{ModuleName}", notificationInfo.ModuleName);
body.Replace("{ForumName}", notificationInfo.ForumName);
body.Replace("{AdminEmail}", notificationInfo.FromEmail);
body.Replace("{MessageLink}", notificationInfo.MessageLink);
body.Replace("{UnsubscribeForumThreadLink}", notificationInfo.UnsubscribeForumThreadLink);
body.Replace("{UnsubscribeForumLink}", notificationInfo.UnsubscribeForumLink);

emailSubject.Replace("{SiteName}", notificationInfo.SiteName);
emailSubject.Replace("{ModuleName}", notificationInfo.ModuleName);
emailSubject.Replace("{ForumName}", notificationInfo.ForumName);
emailSubject.Replace("{Subject}", notificationInfo.Subject);

Jamie

 

2/9/2012 5:39:04 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Email Template field options

On a humorous note, the token replacement system went ahead and replaced the tokens in my post when it sent it out (with the exception of {Subject}, since that is not replaced in the body). So I received this in my email, to give you a reference of how the replacements look for my last post:

I took a quick tour through the source code, and each of the following tokens are being replaced in the message body and subject. So you should be able to use Forums, at least. Any additions to this list would have to be a feature request.

body.Replace("mojoPortal", notificationInfo.SiteName);
body.Replace("Forums", notificationInfo.ModuleName);
body.Replace("Questions about Site Administration", notificationInfo.ForumName);
body.Replace("noreply@mojoportal.com", notificationInfo.FromEmail);
body.Replace("https://www.mojoportal.com/Forums/Thread.aspx?thread=9812&mid=34&pageid=5&ItemID=5&pagenumber=1#post40775", notificationInfo.MessageLink);
body.Replace("https://www.mojoportal.com/Forums/UnsubscribeThread.aspx?threadid=9812", notificationInfo.UnsubscribeForumThreadLink);
body.Replace("https://www.mojoportal.com/Forums/UnsubscribeForum.aspx?mid=34&itemid=5", notificationInfo.UnsubscribeForumLink);

emailSubject.Replace("mojoPortal", notificationInfo.SiteName);
emailSubject.Replace("Forums", notificationInfo.ModuleName);
emailSubject.Replace("Questions about Site Administration", notificationInfo.ForumName);
emailSubject.Replace("{Subject}", notificationInfo.Subject);

2/9/2012 5:59:12 PM
Gravatar
Total Posts 21

Re: Email Template field options

Haha that's awesome. means it's working like intended even when unintended.....

Thanks for the quick reply. ModuleName works for my purposes. Just out of curiosity, which source file was this in? I did a quick scan through the Forums folder in the MojoPortal.Features.UI project but didn't see anything.

Thanks again

Mike

2/9/2012 6:12:25 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Email Template field options

It's in mojoPortal.Net\Notification.cs. Let me explain how I did it, since this may help someone else in the future. In Visual Studio, I used Edit, Find and Replace, Find in Files, and searched for ForumNotificationEmail.config. I found that being used in mojoPortal.Features.UI\Forums\EditPost.aspx.cs, where the contents of the template were being assigned to notificationInfo.BodyTemplate. When I searched files for notificationInfo.BodyTemplate, it led me to Notification.cs. Scrolling down a bit in that file revealed where the token substitutions were happening.

Jamie

You must sign in to post in the forums. This thread is closed to new posts.