Update of /var/cvs/applications/email/documentation
In directory james.mmbase.org:/tmp/cvs-serv26739

Modified Files:
        email.xml 
Log Message:
added some documentation on how to use email 'templates'


See also: http://cvs.mmbase.org/viewcvs/applications/email/documentation


Index: email.xml
===================================================================
RCS file: /var/cvs/applications/email/documentation/email.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- email.xml   21 Dec 2007 10:16:51 -0000      1.14
+++ email.xml   28 Nov 2008 14:35:33 -0000      1.15
@@ -5,7 +5,7 @@
   <articleinfo>
     <title>Email application</title>
     <date>2007-10-10</date>
-    <edition>$Id: email.xml,v 1.14 2007/12/21 10:16:51 michiel Exp $</edition>
+    <edition>$Id: email.xml,v 1.15 2008/11/28 14:35:33 michiel Exp $</edition>
     <authorgroup>
       <author>
         <firstname>Daniel</firstname>
@@ -306,6 +306,35 @@
       ]]></programlisting>
 
     </section>
+    <section>
+      <title>Email dynamic content based on 'templates' mails</title>
+      <para>
+        You can also make emails of the type 'template', which can server as a 
base for actual emails to be sent.
+        it is perhaps easiestly documented by means of an example:
+      </para>
+      <programlisting format="linespecific">
+<![CDATA[
+        <mm:relatednodescontainer type="emails" role="posrel">
+          <mm:constraint field="type" value="TYPE_TEMPLATE" />
+          <mm:sortorder  field="posrel.pos" />
+          <mm:relatednodes>
+            <mm:nodefunction name="clone">
+              <mm:setfield name="to">${user.email}</mm:setfield>
+              <mm:setfield name="type">TYPE_ONESHOT</mm:setfield>
+              <mm:import id="formatarguments" listdelimiter="\|" 
vartype="list"><mm:field node="lesson" name="name" /></mm:import>
+              <mm:function name="startmail" referids="formatarguments" />
+            </mm:nodefunction>
+          </mm:relatednodes>
+]]>
+      </programlisting>
+      <para>
+        This example comes from didactor and does the following. It checks 
whether the current nodes
+        has related email templates. If it does, such a template is cloned, 
and then the 'to' and
+        'type' fields are reset to mirror what we want. This copy is then 
actualy sent, where we
+        also make use of the 'formatarguments' parameter. In this case all 
occurances of {0} (see
+        Java's MessageFormat) are replaced by the name of the lesson.
+      </para>
+    </section>
     <section id="receiving">
       <title>Receiving email</title>
       <para>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to