You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Themba Mbatha <Th...@discoveryhealth.co.za> on 2002/06/24 14:05:37 UTC

Mailer Action.

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.

Re: Mailer Action.

Posted by Ivelin Ivanov <iv...@apache.org>.
Themba Mbatha wrote:
> 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:

There is currenltly a SendmailAction in CVS HEAD 2.1 by Donald Ball.
How does yours differ?

Are you interested to plug-in the emailing logic at the end of the 
Feedback Wizard ?



Ivelin

> 
> <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=gr,p=JavaMail1 
> <http://www-106.ibm.com/developerworks/xml/library/x-xmlist1/?open&l=842,t=gr,p=JavaMail1>) 
> at IBM's developerWorks.
> 
> I just want to let everyone know about this, and would welcome any 
> suggestions.
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org



-- 

-= Ivelin =-


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org