cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Themba Mbatha <Themb...@discoveryhealth.co.za>
Subject Mailer Action.
Date Mon, 24 Jun 2002 12:05:37 GMT
Hi All;

I just developed an emailing action that I use to send email to users based
on what they do on my site (e.g. registering users get sent their user name,
etc). The mailer uses pipelines for content to send through to users:

<map:action name="email" src="bar.foo.actions.MailerAction">
	   <smtp-host>smtpHost</smtp-host>
</map:action>

<map:match pattern="email/register">
  <map:generate src="content/registered.xsp" type="serverpages"/>
  <map:serialize type="xml"/>
</map:match>

<map:match pattern="register">
  <map:act type="add-user">
    ...
    <map:act type="email">
      <map:parameter name="descriptor" value="content/email/config.xml"/>
      <map:parameter name="reloadable" value="true"/>
      <map:redirect-to uri="welcome.html"/>
    </map:act>
  </map:act>
</map:match>

The config specified here would look like this:

<?xml version="1.0"?>
<email>
   <header from="info@foo.bar" subject="Welcome to xxx"/>
   <body src="context://email/register">
	   <part src="context://stylesheets/email-html.xsl"
contentType="text/html"/>
   </body>
</email>

The action is currently implemented with JavaMail 1.2. However, I am not
happy with the fact that I have to write out the transformed events (SAX)
into a StringWriter. This consumes scarce memory resources. So I'm writting
SMTP capabilities into the Action which should enable me to write the
transform events into an Socket's output stream. 

This code borrows elements from this implementation
(http://www-106.ibm.com/developerworks/xml/library/x-xmlist1/?open&l=842,t=g
r,p=JavaMail1) at IBM's developerWorks.

I just want to let everyone know about this, and would welcome any
suggestions.

Mime
View raw message