- Timestamp:
- 10/15/09 19:28:59 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x00/MailerContrib/data/System/MailerContrib.txt
r5033 r5269 136 136 137 137 <!-- 138 * Set SHORTDESCRIPTION = Supports e-mail notification of changes.138 * Set SHORTDESCRIPTION = %$SHORTDESCRIPTION% 139 139 --> 140 ---++ Developer Notes140 ---+++ Tailoring the email format 141 141 The changes mails sent to subscribers are based on a Foswiki template called =mailnotify=. This template must contain the following definitions. 142 142 | =HTML:before= | Section of a HTML mail before the changes | … … 147 147 | =PLAIN:after= | Section of a plain text mail after the changes | 148 148 | =MailNotifyBody= | All the above are embedded in this. %<nop>HTML_TEXT% expands to the HTML obtained by expanding the =HTML:*= templates, and %<nop>PLAIN_TEXT% from the =PLAIN:*= templates. | 149 The default template sends multipart mails containing both HTML and plaintext versions. You can easily provide a custom version of this template using a local skin. 149 The default template sends multipart mails containing both HTML and plaintext versions. 150 151 To tailor the email format please avoid editing the distributed mailnotify.tmpl file as you will regret when it later gets overwritten when you upgrade Foswiki. Instead you should either use a skin setting to choose the template file or use web part of the [[%SYSTEMWEB%.SkinTemplates#FindingTemplates][template search path rules]]. 152 153 It is recommended to use the skin method as it is easier to control, and requires less hacking around. Especially if you need to use the same tailoring for many or all webs. 154 155 * Simple global tailoring used in all webs using your normal default skin 156 * Make a copy of =templates/mailnotify.tmpl= called =templates/mailnotify.skiname.tmpl=. For example =templates/mailnotify.pattern.tmpl= and modify this copy to your need. If you use the !NatSkin simply use =templates/mailnotify.nat.tmpl= instead 157 158 * Using a dummy skin name globally 159 * In !%USERSWEB%.SitePreferences define a setting =* Set SKIN = notifyskin,pattern= where the notifyskin is the dummy skin name and the pattern in this example is the real skin. 160 * Create a =templates/mailnotify.notifyskin.tmpl= with your tailorings 161 162 * Using a dummy skin name per web 163 * In each web where you want a special mailnotify template add the setting =* Set SKIN = notifywebname,pattern= where the notifywebname is the dummy skin name for this web and the pattern in this example is the real skin. 164 * For each web where you need a special mailnotify template create a =templates/mailnotify.notifywebname.tmpl= with your tailorings 165 166 * Using the web path in the templates directory 167 * For each web where you want a special mailnotify create subdirectories in =templates= with the same names as the webs and place a =templates/mailnotify.tmpl= in these subdirectories with your tailorings 150 168 151 169 Newsletters are sent after formatting using the standard =view= template, using whatever skin is selected in the topic being mailed. 170 171 ---+++ Using a topic defined email template 172 173 If you want to use a topic to define the notify email format this is possible with a small workaround. Before you go ahead and do this you need to consider the security implication. Making the email format available to any user from a browser means that spammers can abuse this to create messages where they can spoof the from address. Only use this method if your Foswiki installation is safely behind a firewall and your users can be trusted. 174 175 The method can best be shown with an example. In the following we... 176 177 * Define a custom mailnotify template based on a skin setting in !WebNotify 178 * Allow the users to define the mail format in a topic called !WebNotifyCustomTemplate 179 180 Here are the steps 181 182 First we create a file =templates/mailnotify.customnotify.tmpl= which only contains these two lines 183 184 <verbatim> 185 %TMPL:INCLUDE{"mailnotify"}% 186 %TMPL:INCLUDE{"WebNotifyCustom"}% 187 </verbatim> 188 189 In the webs where you want the topic defined mail format we add the setting =* Set SKIN = customnotify,pattern= (assuming pattern is the normal skin) 190 191 And we create a topic in the web called !WebNotifyCustomTemplate which contains the entire mailnotify template you want to use. Simply copy the content from =templates/mailnotify.tmpl= to this template and do the tailoring. 152 192 153 193 ---+++ Contrib Info … … 160 200 161 201 | Author: | [[http://c-dot.co.uk][Crawford Currie]] | 162 | Copyright ©: | 2004, Wind River Systems; 2008, http://WikiRing.com |202 | Copyright ©: | 2004, Wind River Systems; 2008, http://WikiRing.com; 2009 Foswiki Contributors | 163 203 | License: | GPL | 164 204 | Version: | %$VERSION% | 165 205 | Release: | %$RELEASE% | 166 206 | Change History: | | 207 | 15 Oct 2009 | Foswikitask:Item2260. Make the feature that allows defining the email template based in either skin or web path. And improve the documentation so people can learn how to tailor the emails that the WebNotify feature sends. <br /> Foswikitask:Item1603: use quotes to protect topic names with odd characters in them | 167 208 | 20 Sep 2009 | Small documentation update for Foswiki 1.0.7 release (RELEASE and adding parent) | 168 209 | 23 Apr 2009 | Foswikitask:Item1501: Minor bug in logfile output fixed |
Note: See TracChangeset
for help on using the changeset viewer.
