Index: main/plugin-cms/src/org/ametys/cms/workflow/SendMailFunction.java
===================================================================
--- main/plugin-cms/src/org/ametys/cms/workflow/SendMailFunction.java	(revision 40099)
+++ main/plugin-cms/src/org/ametys/cms/workflow/SendMailFunction.java	(working copy)
@@ -33,7 +33,6 @@
 import org.ametys.cms.repository.WorkflowAwareContent;
 import org.ametys.plugins.repository.AmetysRepositoryException;
 import org.ametys.plugins.workflow.Workflow;
-import org.ametys.plugins.workflow.store.AmetysStep;
 import org.ametys.runtime.config.Config;
 import org.ametys.runtime.plugin.component.PluginAware;
 import org.ametys.runtime.plugins.core.mail.SendMailHelper;
@@ -47,14 +46,12 @@
 import com.opensymphony.module.propertyset.PropertySet;
 import com.opensymphony.workflow.FunctionProvider;
 import com.opensymphony.workflow.WorkflowException;
-import com.opensymphony.workflow.spi.Step;
 
 /**
  * OS workflow function to send mail after an action is triggered.
  */
 public class SendMailFunction extends AbstractContentWorkflowComponent implements FunctionProvider, Initializable, PluginAware
 {
-    
     /**
      * Provide "false" to prevent the function sending the mail.
      * Useful when making large automatic workflow operations (for instance, when bulk importing and proposing in one action). 
@@ -106,6 +103,7 @@
         _pluginName = pluginName;
     }
     
+    @Override
     public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException
     {
         String rightsParam = StringUtils.defaultString((String) args.get(RIGHTS_KEY));
@@ -144,7 +142,7 @@
             Set<String> userLogins = _getLogins(content, rights);
             
             String mailSubject = getMailSubject(subjectI18nKey, user, content);
-            String mailBody = getMailBody(bodyI18nKey, user, content);
+            String mailBody = getMailBody(bodyI18nKey, user, content, transientVars);
             
             _sendMails(mailSubject, mailBody, userLogins, user.getEmail());
         }
@@ -172,35 +170,25 @@
      * @param bodyI18nKey the i18n key to use for body
      * @param user the caller
      * @param content the content
+     * @param transientVars the transient variables
      * @return the text body
      */
-    protected String getMailBody (String bodyI18nKey, User user, WorkflowAwareContent content)
+    protected String getMailBody (String bodyI18nKey, User user, WorkflowAwareContent content, Map transientVars)
     {
         I18nizableText bodyKey = new I18nizableText(null, bodyI18nKey, getBodyI18nParams(user, content));
         String mailBody = _i18nUtils.translate(bodyKey, null); // FIXME Use user preference language
         
         // Get the workflow comment
-        long workflowId = content.getWorkflowId();
-        Iterator<Step> steps = _workflow.getHistorySteps(workflowId).iterator();
-        
-        // Browse the step list to find the newest proposition action.
-        if (steps.hasNext())
+        String comment = (String) transientVars.get("comment");
+        if (StringUtils.isNotEmpty(comment))
         {
-            Step step = steps.next();
-            if (step instanceof AmetysStep)
-            {
-                String comment = (String) ((AmetysStep) step).getProperty("comment");
-                if (StringUtils.isNotEmpty(comment))
-                {
-                    List<String> params = new ArrayList<String>();
-                    params.add(comment);
-                    
-                    I18nizableText commentKey = new I18nizableText("plugin.cms", "WORKFLOW_MAIL_BODY_USER_COMMENT", params);
-                    String commentTxt = _i18nUtils.translate(commentKey, null); // FIXME Use user preference language
-                    
-                    mailBody += "\n\n" + commentTxt; 
-                }
-            }
+            List<String> params = new ArrayList<String>();
+            params.add(comment);
+            
+            I18nizableText commentKey = new I18nizableText("plugin.cms", "WORKFLOW_MAIL_BODY_USER_COMMENT", params);
+            String commentTxt = _i18nUtils.translate(commentKey, null); // FIXME Use user preference language
+            
+            mailBody += "\n\n" + commentTxt; 
         }
         
         return mailBody;
