Hi all, I appologise in advance for submitting this update / enhancement to cocoon-users - but perhaps a member of the cocoon-dev list can do the needful :)
The replacement template from sendmail.xsl included below allows sending of rich-text mail content. HTML content can be included by qualifying the <sendmail:body/> tag with a mime-type attribute, for example: <sendmail:send-mail> ... <sendmail:body mime-type="text/html"> </sendmail:send-mail> I believe that this change should also work with the C2 logicsheet, but I have not yet had a chance to try that. Hope others find this useful, Cheers Adrian <xsl:template match="sendmail:send-mail"> <xsl:variable name="from"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="sendmail:from"/></xsl:call-template></xsl:variable> <xsl:variable name="to"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="sendmail:to"/></xsl:call-template></xsl:variable> <xsl:variable name="subject"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="sendmail:subject"/></xsl:call-template></xsl:variable> <xsl:variable name="body"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="sendmail:body"/></xsl:call-template></xsl:variable> <xsl:variable name="mime-type"> <xsl:choose> <xsl:when test="sendmail:body/@mime-type"><xsl:value-of select="sendmail:body/@mime-type"/></xsl:when> <xsl:otherwise>text/plain</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="smtphost"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="sendmail:smtphost"/></xsl:call-template></xsl:variable> <xsp:logic> try { Properties _properties = new Properties(this._properties); if (!"null".equals(String.valueOf(<xsl:copy-of select="$smtphost"/>))) { _properties.put("mail.smtp.host",String.valueOf(<xsl:copy-of select="$smtphost"/>)); } Session _sendmail_session = Session.getDefaultInstance(_properties,null); Message _message = new MimeMessage(_sendmail_session); InternetAddress _from = new InternetAddress(String.valueOf(<xsl:copy-of select="$from"/>)); _message.setFrom(_from); InternetAddress _to = new InternetAddress(String.valueOf(<xsl:copy-of select="$to"/>)); _message.setRecipient(Message.RecipientType.TO,_to); _message.setSentDate(new Date()); _message.setSubject(String.valueOf(<xsl:copy-of select="$subject"/>)); _message.setContent(String.valueOf(<xsl:copy-of select="$body"/>), String.valueOf("<xsl:copy-of select="$mime-type"/>")); Transport.send(_message); } catch (AddressException e) { <error type="user">Your email address is invalid.</error> } catch (MessagingException e) { <error type="server">An error occured while sending email.</error> } </xsp:logic> </xsl:template> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>