There is a sendmail logicsheet, not documented on the website.  To use it
is pretty simple, here's an example of what you might do with a POST from a
message form:

<xsp:page
  xmlns:xsp="http://apache.org/xsp";
  xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0";
>
  <page>

     <xsp:logic>
       String from = request.getParameter("from");
       String to = request.getParameter("to");
       String cc = request.getParameter("cc");
       String bcc = request.getParameter("bcc");
       String subject = request.getParameter("subject");
       String body = request.getParameter("body");

       // the java sendmail interface apparently dislikes empty string
addresses
       if ("".equals(cc)) { cc = null; }
       if ("".equals(bcc)) { bcc = null; }
     </xsp:logic>

     <message-status>
       <xsp:logic>
            boolean success = true;
            try {
               <sendmail:send-mail>
                 <sendmail:from><xsp:expr>from</xsp:expr></sendmail:from>
                 <sendmail:to><xsp:expr>to</xsp:expr></sendmail:to>
                 <sendmail:cc><xsp:expr>cc</xsp:expr></sendmail:cc>
                 <sendmail:bcc><xsp:expr>bcc</xsp:expr></sendmail:bcc>
                 <
sendmail:subject><xsp:expr>subject</xsp:expr></sendmail:subject>
                 <
sendmail:body><xsp:expr>message</xsp:expr></sendmail:body>
                 <sendmail:smtphost>smtp.mydomain.com</sendmail:smtphost>
               </sendmail:send-mail>
            } catch (Exception e) {
               success = false;
            }
            if (success) {
               <success><xsp:expr>to</xsp:expr></success>
            } else {
               <error><xsp:expr>to</xsp:expr></error>
            }
          }
       </xsp:logic>
     </message-status>
  </page>
</xsp:page>

HTH,
-Christopher



                                                                                       
                                               
                      "boessem"                                                        
                                               
                      <[EMAIL PROTECTED]        To:       "Cocoon-Users" <[EMAIL 
PROTECTED]>                                 
                      de>                      cc:                                     
                                               
                                               Subject:  mail function                 
                                               
                      03/17/2003 05:11                                                 
                                               
                      AM                                                               
                                               
                      Please respond to                                                
                                               
                      cocoon-users                                                     
                                               
                                                                                       
                                               
                                                                                       
                                               




hi,

i am quite new to cocoon, and try to write a registration using xsp.

my question is, if there is a funktion like within php to automatically
send a mail to me, with the registration informations.

any comment would be helpfull. i searched for comments on this within the
cocoon mailinglist archive, but couldn#t even find questions related to
that subject. so if anyone knows links, to give me a brief overview how to
archive a function like this, please mail.

thanks
and regards





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to