cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Painter-Wakefield" <paint...@mc.duke.edu>
Subject Re: mail function
Date Mon, 17 Mar 2003 13:43:17 GMT

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"                                                          
                                            
                      <philipp@boessem.        To:       "Cocoon-Users" <cocoon-users@xml.apache.org>
                                
                      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: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message