pvollenweider    2005/04/29 15:22:10 CEST

  Modified files:        (Branch: JAHIA-4-1-BRANCH)
    etc/struts           struts-config.xml 
    src/java/org/jahia/services/mail MailService.java 
    var/shared_templates corporate_portal_templates.jar 
  Log:
  LoQutus contribution
  
  Revision         Changes     Path
  1.7.4.1.2.5      +4 -0       jahia/etc/struts/struts-config.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/etc/struts/struts-config.xml.diff?r1=1.7.4.1.2.4&r2=1.7.4.1.2.5&f=h
  1.4.6.1          +88 -0      
jahia/src/java/org/jahia/services/mail/MailService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/services/mail/MailService.java.diff?r1=1.4&r2=1.4.6.1&f=h
  1.104.2.23.2.25  +1009 -731  
jahia/var/shared_templates/corporate_portal_templates.jar
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/var/shared_templates/corporate_portal_templates.jar.diff?r1=1.104.2.23.2.24&r2=1.104.2.23.2.25&f=h
  
  
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/repository/jahia/etc/struts/Attic/struts-config.xml,v
  retrieving revision 1.7.4.1.2.4
  retrieving revision 1.7.4.1.2.5
  diff -u -r1.7.4.1.2.4 -r1.7.4.1.2.5
  --- struts-config.xml 12 Apr 2005 09:49:13 -0000      1.7.4.1.2.4
  +++ struts-config.xml 29 Apr 2005 13:22:05 -0000      1.7.4.1.2.5
  @@ -23,6 +23,8 @@
   
       <form-bean      name="adminMainForm"
                       type="org.jahia.views.administration.forms.MainForm"/>
  +    <form-bean name="genericForm" 
type="jahiatemplates.genericform.GenericForm">
  +    </form-bean>
   
     </form-beans>
   
  @@ -135,6 +137,8 @@
                   <forward name="showSiteSetting" 
path="admin.htmleditors.manage-site-setting" />
                   <forward name="saveSiteSetting" 
path="admin.htmleditors.manage-site-setting" />
       </action>
  +     <action path="/GenericFormHandler" 
type="jahiatemplates.genericform.GenericFormHandlerAction" name="genericForm" 
scope="request" validate="true">
  +     </action>
   
   
   
  
  
  
  Index: MailService.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/src/java/org/jahia/services/mail/Attic/MailService.java,v
  retrieving revision 1.4
  retrieving revision 1.4.6.1
  diff -u -r1.4 -r1.4.6.1
  --- MailService.java  7 Nov 2003 18:39:25 -0000       1.4
  +++ MailService.java  29 Apr 2005 13:22:06 -0000      1.4.6.1
  @@ -18,6 +18,7 @@
   import java.util.Properties;
   
   import javax.mail.Message;
  +import javax.mail.Multipart;
   import javax.mail.Session;
   import javax.mail.Transport;
   import javax.mail.internet.InternetAddress;
  @@ -35,6 +36,7 @@
    * </p>
    * <p>Copyright: MAP (Jahia Solutions S�rl 2003)</p>
    * <p>Company: Jahia Solutions S�rl</p>
  + * LOQUTUS PATCH : Added sendMail method which allows the use of a Multipart 
object for the email body
    * @author MAP
    * @version 1.0
    */
  @@ -228,6 +230,92 @@
           return true;
       }
   
  +    /**
  +     *
  +     * Send a message to the desired addressee with the specified subject, 
message
  +     * and attachments, using the default mail host.
  +     *
  +     * @param from The message sender
  +     * @param to The message destination.
  +     * @param subject The message subject.
  +     * @param message The message to send.
  +     * @param attachments The attachments to add to the message.
  +     * @return True if message is sent successfully, false otherwise
  +     */
  +    public boolean sendMessage(
  +      String from,
  +      String to,
  +      String subject,
  +      Multipart multipart) {
  +      try {
  +        if (to == null) {
  +          to = defaultRecipient();
  +        }
  +        if (from == null) {
  +          from = defaultSender();
  +        }
  +
  +        if (mailhost == null || to == null || from == null) {
  +          logger.debug("*** sendMessage : Mail settings not valid, 
ignoring...");
  +          return false;
  +        }
  +        if (mailhost.equals("") || to.equals("") || from.equals("")) {
  +          logger.debug("*** sendMessage : Mail settings not valid, 
ignoring...");
  +          return false;
  +        }
  +        logger.debug(
  +          "Send mail using settings mailhost=["
  +            + mailhost
  +            + "] to=["
  +            + to
  +            + "] from=["
  +            + from
  +            + "]");
  +        Properties props = System.getProperties();
  +        props.put("mail.smtp.host", mailhost);
  +        // Get a Session object
  +        Session session = Session.getDefaultInstance(props, null);
  +        // Construct the message
  +        MimeMessage msg = new MimeMessage(session);
  +
  +
  +        if (from != null) {
  +          msg.setFrom(new InternetAddress(from));
  +        } else {
  +          msg.setFrom();
  +        }
  +        msg.setRecipients(
  +          Message.RecipientType.TO,
  +          InternetAddress.parse(to, false));
  +
  +        if (subject == null || "".equals(subject)) {
  +          subject = "[JAHIA] Jahia Message";
  +        }
  +
  +        msg.setSubject(subject, "ISO-8859-1");
  +        msg.setHeader("X-Mailer", mailer);
  +        msg.setSentDate(new Date());
  +
  +        if (multipart != null) {
  +          msg.setContent(multipart);
  +        }
  +
  +        Transport.send(msg);
  +
  +        //    --------------------------------------
  +        logger.debug("*** sendMessage : Mailing to " + to + " via " + 
mailhost + "...");
  +
  +        // send the thing off
  +        //      sendMessage(msg);
  +        logger.debug("*** sendMessage : Mail was sent successfully.");
  +
  +      } catch (Throwable th) {
  +        logger.error("*** sendMessage : Error while sending mail : " + 
th.getMessage(), th);
  +        return false;
  +      }
  +      return true;
  +    }
  +
       public String defaultRecipient() {
           return this.to;
       }
  
  
  
  Index: corporate_portal_templates.jar
  ===================================================================
        <<Binary file>>
  

Reply via email to