Page: http://wiki.cocoondev.org/Wiki.jsp?page=SandBox , version: 125 on Fri Jun 20 01:11:17 2003 by DavidCrossley
- xGo Wild!!! ? - + Go Wild!!! - Please leave these examples intact for others to learn. + Please leave these examples intact for others to learn and make your changes at the bottom of this page. - <h1>Zowee!</h1> + <h1>Zowee!</h1> ... see, HTML tags have no effect! Page: http://wiki.cocoondev.org/Wiki.jsp?page=MailBodyViaPipeline , version: 1 on Fri Jun 20 01:03:47 2003 by BillHumphries New page created: + So I'd like to call this [KoraInHell], but that's not a descriptive wiki word. :) + + !!In which yhos flails about trying to get a Sendmail component to include content from another pipeline. + + ''Here's what I'm trying to do:'' + + Include generated content (i.e. content produced by a pipeline) into the body of an email sent by sendmail action or logicsheet. + + --- + + Unfortunately, neither the documentation, nor the cocoondev.org wiki discuss this. They go into great detail into [how to add a request parameter to a mail|http://cocoon.apache.org/2.1/userdocs/xsp/sendmail.html], but not generated content. Thus, I've been going at this by trial and error. + + The [sendmail action|http://cocoon.apache.org/2.1/userdocs/actions/sendmail-action.html] has been a deadend, so I've looked at the sendmail logicsheet. Below is mail.xsp, my attempt to implement sending a message body created by a pipeline. That pipeline's output is brought in via [CInclude] Please note that I have defined the necessary namespaces in the xsp:page element: + + {{{<?xml version="1.0" encoding="ISO-8859-1"?> + <xsp:page language="java" + xmlns:xsp="http://apache.org/xsp" + xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0" + xmlns:cinclude="http://apache.org/cocoon/include/1.0" > + <email> + <xsp:logic /> + <sendmail:send-mail> + <sendmail:from>[EMAIL PROTECTED]</sendmail:from> + <sendmail:to>[EMAIL PROTECTED]</sendmail:to> + <sendmail:subject>Pipeline Results</sendmail:subject> + <sendmail:smtphost>smtp.example.org</sendmail:smtphost> + <sendmail:body>The results of processing the pipeline + triggered at the uri: workPlanning/contents. are below.<br/> + <!-- NB: the request below has been tested and works when called directly --> + <cinclude:include src="cocoon://workPlanning/contents" element="included" /> + </sendmail:body> + <sendmail:on-success> + <p> + Email successfully sent. + </p> + </sendmail:on-success> + <sendmail:on-error> + <p style="color:red;"> + An error occurred: <sendmail:error-message/> + </p> + </sendmail:on-error> + </sendmail:send-mail> + </email> + </xsp:page>}}} + + The sendmail logicsheet has been defined in cocoon.xconf, and a matcher added to the pipeline. + + {{{<map:match pattern="workPlanning/send"> + <map:generate type="serverpages" src="workPlanning/mail.xsp" /> + <map:serialize /> + </map:match>}}} + + When we request workPlanning/send, Cocoon fails with an error: + + {{{org.apache.cocoon.components.language.LanguageException: Error compiling mail_xsp: + ERROR 1 (org/apache/cocoon/www/samples/xmlform/workPlanning/mail_xsp.java): + ... + "", + "br", + "br", + xspAttr + + // start error (lines 157-157) "Syntax error on token ";", ")" expected" + ); + + // end error + xspAttr.clear(); + ... + Line 157, column 0: Syntax error on token ";", ")" expected}}} + + So what's the right way to go about this? + Page: http://wiki.cocoondev.org/Wiki.jsp?page=BillHumphries , version: 3 on Fri Jun 20 01:04:42 2003 by BillHumphries - I am XML, XSLT developer, coming to Cocoon from the world of [PHP], interested in [ContentManagementSystems] and the [SemanticWeb]. + I am a XML, XSLT developer, coming to Cocoon from the world of [PHP], interested in [ContentManagementSystems] and the [SemanticWeb]. ? ++
