Author: vmassol
Date: 2007-11-16 16:48:57 +0100 (Fri, 16 Nov 2007)
New Revision: 5949

Added:
   xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/
   xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
Removed:
   xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
   
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
Log:
[maven-release-plugin]  copy for tag xwiki-plugin-mailsender-1.0

Copied: xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0 (from rev 
5902, xwiki-platform/xwiki-plugins/trunk/mailsender)

Deleted: xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml
===================================================================
--- xwiki-platform/xwiki-plugins/trunk/mailsender/pom.xml       2007-11-16 
10:41:57 UTC (rev 5902)
+++ xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml       
2007-11-16 15:48:57 UTC (rev 5949)
@@ -1,19 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-  <parent>
-    <artifactId>xwiki-plugins</artifactId>
-    <groupId>com.xpn.xwiki.platform.plugins</groupId>
-    <version>2-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>xwiki-plugin-mailsender</artifactId>
-  <name>XWiki Platform - Plugins - Mail Sender</name>
-  <version>1.0-SNAPSHOT</version>
-  <description>XWiki Platform - Plugins - Mail Sender</description>
-  <dependencies>
-    <dependency>
-      <groupId>com.xpn.xwiki.platform</groupId>
-      <artifactId>xwiki-core</artifactId>
-      <version>1.2-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-</project>
\ No newline at end of file

Copied: xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml 
(from rev 5948, xwiki-platform/xwiki-plugins/trunk/mailsender/pom.xml)
===================================================================
--- xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml       
                        (rev 0)
+++ xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/pom.xml       
2007-11-16 15:48:57 UTC (rev 5949)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>xwiki-plugins</artifactId>
+    <groupId>com.xpn.xwiki.platform.plugins</groupId>
+    <version>2</version>
+  </parent>
+  <artifactId>xwiki-plugin-mailsender</artifactId>
+  <name>XWiki Platform - Plugins - Mail Sender</name>
+  <version>1.0</version>
+  <description>XWiki Platform - Plugins - Mail Sender</description>
+  <dependencies>
+    <dependency>
+      <groupId>com.xpn.xwiki.platform</groupId>
+      <artifactId>xwiki-core</artifactId>
+      <version>1.2-milestone-2</version>
+    </dependency>
+  </dependencies>
+
+  <scm>
+    
<connection>scm:svn:http://svn.xwiki.org/svnroot/xwiki/xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0</connection>
+    
<developerConnection>scm:svn:https://svn.xwiki.org/svnroot/xwiki/xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0</developerConnection>
+    
<url>http://svn.xwiki.org/svnroot/xwiki/xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0</url>
+  </scm>
+</project>
\ No newline at end of file

Deleted: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
===================================================================
--- 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
       2007-11-16 10:41:57 UTC (rev 5902)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
       2007-11-16 15:48:57 UTC (rev 5949)
@@ -1,130 +0,0 @@
-package com.xpn.xwiki.plugin.mailsender;
-import java.util.List;
-
-import com.xpn.xwiki.api.Attachment;
-
-/**
- * The variables to, cc, bcc can contain several email addresses, separated by 
commas.
- */
-public class Mail
-{
-    private String to;
-    private String from;
-    private String cc;
-    private String bcc;
-    private String subject;
-    private String textPart;
-    private String htmlPart;
-    private List attachments;
-    
-
-    public List getAttachments()
-    {
-        return attachments;
-    }
-
-
-    public void setAttachments(List attachments)
-    {
-        this.attachments = attachments;
-    }
-
-
-    public Mail()
-    {
-        super();
-    }
-    
-    
-    public Mail(String from, String to, String cc, String bcc, String subject, 
String message, String htmlPart)
-    {
-        super();
-        this.from = from;
-        this.to = to;
-        this.cc = cc;
-        this.bcc = bcc;
-        this.subject = subject;
-        this.textPart = message;
-        this.htmlPart = htmlPart;
-    }
-
-
-    public String getFrom()
-    {
-        return from;
-    }
-
-    public void setFrom(String from)
-    {
-        this.from = from;
-    }
-
-    public String getTo()
-    {
-        return to;
-    }
-
-    public void setTo(String to)
-    {
-        this.to = to;
-    }
-
-    public String getCc()
-    {
-        return cc;
-    }
-
-    public void setCc(String cc)
-    {
-        this.cc = cc;
-    }
-
-    public String getBcc()
-    {
-        return bcc;
-    }
-
-    public void setBcc(String bcc)
-    {
-        this.bcc = bcc;
-    }
-
-    public String getSubject()
-    {
-        return subject;
-    }
-
-    public void setSubject(String subject)
-    {
-        this.subject = subject;
-    }
-
-    public String getTextPart()
-    {
-        return textPart;
-    }
-
-    public void setTextPart(String message)
-    {
-        this.textPart = message;
-    }
-
-    public String toFullString()
-    {
-        return "From: " + from + "\nTo: " + to + "\nCc: " + cc + "\nBcc: " + 
bcc + "\nSubject:"
-            + subject + "\nText: " + textPart+" \nHTML:"+htmlPart;
-    }
-
-
-    public String getHtmlPart()
-    {
-        return htmlPart;
-    }
-
-
-    public void setHtmlPart(String htmlPart)
-    {
-        this.htmlPart = htmlPart;
-    }
-
-}

Copied: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
 (from rev 5947, 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java)
===================================================================
--- 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
                               (rev 0)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/Mail.java
       2007-11-16 15:48:57 UTC (rev 5949)
@@ -0,0 +1,148 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.plugin.mailsender;
+
+import java.util.List;
+
+/**
+ * The variables to, cc, bcc can contain several email addresses, separated by 
commas.
+ */
+public class Mail
+{
+    private String to;
+    private String from;
+    private String cc;
+    private String bcc;
+    private String subject;
+    private String textPart;
+    private String htmlPart;
+    private List attachments;
+    
+
+    public List getAttachments()
+    {
+        return attachments;
+    }
+
+
+    public void setAttachments(List attachments)
+    {
+        this.attachments = attachments;
+    }
+
+
+    public Mail()
+    {
+        super();
+    }
+    
+    
+    public Mail(String from, String to, String cc, String bcc, String subject, 
String message, String htmlPart)
+    {
+        super();
+        this.from = from;
+        this.to = to;
+        this.cc = cc;
+        this.bcc = bcc;
+        this.subject = subject;
+        this.textPart = message;
+        this.htmlPart = htmlPart;
+    }
+
+
+    public String getFrom()
+    {
+        return from;
+    }
+
+    public void setFrom(String from)
+    {
+        this.from = from;
+    }
+
+    public String getTo()
+    {
+        return to;
+    }
+
+    public void setTo(String to)
+    {
+        this.to = to;
+    }
+
+    public String getCc()
+    {
+        return cc;
+    }
+
+    public void setCc(String cc)
+    {
+        this.cc = cc;
+    }
+
+    public String getBcc()
+    {
+        return bcc;
+    }
+
+    public void setBcc(String bcc)
+    {
+        this.bcc = bcc;
+    }
+
+    public String getSubject()
+    {
+        return subject;
+    }
+
+    public void setSubject(String subject)
+    {
+        this.subject = subject;
+    }
+
+    public String getTextPart()
+    {
+        return textPart;
+    }
+
+    public void setTextPart(String message)
+    {
+        this.textPart = message;
+    }
+
+    public String toFullString()
+    {
+        return "From: " + from + "\nTo: " + to + "\nCc: " + cc + "\nBcc: " + 
bcc + "\nSubject:"
+            + subject + "\nText: " + textPart+" \nHTML:"+htmlPart;
+    }
+
+
+    public String getHtmlPart()
+    {
+        return htmlPart;
+    }
+
+
+    public void setHtmlPart(String htmlPart)
+    {
+        this.htmlPart = htmlPart;
+    }
+
+}

Deleted: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
===================================================================
--- 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
        2007-11-16 10:41:57 UTC (rev 5902)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
        2007-11-16 15:48:57 UTC (rev 5949)
@@ -1,182 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package com.xpn.xwiki.plugin.mailsender;
-
-import com.xpn.xwiki.XWikiContext;
-import com.xpn.xwiki.api.Context;
-import com.xpn.xwiki.plugin.PluginApi;
-import org.apache.velocity.VelocityContext;
-
-import java.util.List;
-
-/**
- * Plugin that brings powerful mailing capbilities to XWiki Recipients : to, 
cc, bcc Text messages
- * HTML messages with attachments Text + HTML messages from XWiki pages 
templates Send a collection
- * of mails in one call
- *
- * This is the wrapper accessible from in-document scripts.
- *
- * @version $Id: $
- */
-public class MailSenderPluginApi extends PluginApi
-{
-    /**
-     * API constructor.
-     *
-     * @param plugin The wrapped plugin object.
-     * @param context Context of the request.
-     * @see 
PluginApi#PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface,XWikiContext)
-     */
-    public MailSenderPluginApi(MailSenderPlugin plugin, XWikiContext context)
-    {
-        super(plugin, context);
-    }
-
-    /**
-     * Get the MailSenderPlugin
-     *
-     * @return The MailSenderPlugin
-     */
-    public MailSenderPlugin getMailSenderPlugin()
-    {
-        return (MailSenderPlugin) getPlugin();
-    }
-
-    /**
-     * Sends an HTML mail, with a list of attachments
-     *
-     * @param to the recipient of the message
-     * @param from the sender
-     * @param cc carbon copy
-     * @param bcc hidden carbon copy
-     * @param subject the subject of the message
-     * @param body the body content of the mail
-     * @param alternative the alternative text offered to the mail client
-     * @param attachments List of com.xpn.xwiki.api.Attachment that will be 
attached to the mail.
-     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
-     */
-    public int sendHtmlMessage(String from, String to, String cc, String bcc, 
String subject,
-        String body, String alternative, List attachments)
-    {
-        try {
-            Mail email = new Mail();
-            email.setSubject(subject);
-            email.setFrom(from);
-            email.setTo(to);
-            email.setCc(cc);
-            email.setBcc(bcc);
-            email.setTextPart(alternative);
-            email.setHtmlPart(body);
-            email.setAttachments(attachments);
-            getMailSenderPlugin().sendMail(email, context);
-            return 0;
-        } catch (Exception e) {
-            context.put("error", e.getMessage());
-            getMailSenderPlugin().getLogger().error("sendHtmlMessage", e);
-            return -1;
-        }
-    }
-
-    /**
-     * Sends a simple text plain mail
-     *
-     * @param to the recipient of the message
-     * @param from the sender
-     * @param subject the subject of the message
-     * @param message the body of the message
-     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
-     */
-    public int sendTextMessage(String from, String to, String subject, String 
message)
-    {
-        try {
-            Mail email = new Mail();
-            email.setSubject(subject);
-            email.setTextPart(message);
-            email.setFrom(from);
-            email.setTo(to);
-
-            getMailSenderPlugin().sendMail(email, context);
-            return 0;
-        } catch (Exception e) {
-            context.put("error", e.getMessage());
-            getMailSenderPlugin().getLogger().error("sendTextMessage", e);
-            return -1;
-        }
-    }
-
-    /**
-     * Sends a simple text plain mail with a list of files attachments
-     *
-     * @param to the recipient of the message
-     * @param from the sender
-     * @param cc carbon copy
-     * @param bcc hidden carbon copy
-     * @param subject the subject of the message
-     * @param message the body of the message
-     * @param attachments List of com.xpn.xwiki.api.Attachment that will be 
attached to the mail.
-     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
-     */
-    public int sendTextMessage(String from, String to, String cc, String bcc, 
String subject,
-        String message, List attachments)
-    {
-        try {
-            Mail email = new Mail();
-            email.setSubject(subject);
-            email.setTextPart(message);
-            email.setFrom(from);
-            email.setTo(to);
-            email.setCc(cc);
-            email.setBcc(bcc);
-            email.setAttachments(attachments);
-            getMailSenderPlugin().sendMail(email, context);
-            return 0;
-        } catch (Exception e) {
-            context.put("error", e.getMessage());
-            getMailSenderPlugin().getLogger().error("sendTextMessage", e);
-            return -1;
-        }
-    }
-
-    /**
-     * Uses an XWiki document to build the message subject and context, based 
on variables stored in
-     * the VelocityContext. Sends the email.
-     *
-     * @param from Email sender
-     * @param to Email recipient
-     * @param cc Email Carbon Copy
-     * @param bcc Email Hidden Carbon Copy
-     * @param language Language of the email
-     * @param documentFullName Full name of the template to be used (example:
-     * XWiki.MyEmailTemplate). The template needs to have an XWiki.Email 
object attached
-     * @param vcontext Velocity context passed to the velocity renderer
-     * @return True if the email has been sent
-     */
-    public int sendMessageFromTemplate(String from, String to, String cc, 
String bcc,
-        String language, String documentFullName, VelocityContext vcontext)
-    {
-        try {
-            return 
getMailSenderPlugin().sendMailFromTemplate(documentFullName, from, to, cc, bcc,
-                language, vcontext, context);
-        } catch (Exception e) {
-            getMailSenderPlugin().getLogger().error("sendMessageFromTemplate", 
e);
-            return -1;
-        }
-    }
-}

Copied: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
 (from rev 5947, 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java)
===================================================================
--- 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
                                (rev 0)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java
        2007-11-16 15:48:57 UTC (rev 5949)
@@ -0,0 +1,181 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.plugin.mailsender;
+
+import com.xpn.xwiki.XWikiContext;
+import com.xpn.xwiki.plugin.PluginApi;
+import org.apache.velocity.VelocityContext;
+
+import java.util.List;
+
+/**
+ * Plugin that brings powerful mailing capbilities to XWiki Recipients : to, 
cc, bcc Text messages
+ * HTML messages with attachments Text + HTML messages from XWiki pages 
templates Send a collection
+ * of mails in one call
+ *
+ * This is the wrapper accessible from in-document scripts.
+ *
+ * @version $Id: $
+ */
+public class MailSenderPluginApi extends PluginApi
+{
+    /**
+     * API constructor.
+     *
+     * @param plugin The wrapped plugin object.
+     * @param context Context of the request.
+     * @see 
PluginApi#PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface,XWikiContext)
+     */
+    public MailSenderPluginApi(MailSenderPlugin plugin, XWikiContext context)
+    {
+        super(plugin, context);
+    }
+
+    /**
+     * Get the MailSenderPlugin
+     *
+     * @return The MailSenderPlugin
+     */
+    public MailSenderPlugin getMailSenderPlugin()
+    {
+        return (MailSenderPlugin) getPlugin();
+    }
+
+    /**
+     * Sends an HTML mail, with a list of attachments
+     *
+     * @param to the recipient of the message
+     * @param from the sender
+     * @param cc carbon copy
+     * @param bcc hidden carbon copy
+     * @param subject the subject of the message
+     * @param body the body content of the mail
+     * @param alternative the alternative text offered to the mail client
+     * @param attachments List of com.xpn.xwiki.api.Attachment that will be 
attached to the mail.
+     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
+     */
+    public int sendHtmlMessage(String from, String to, String cc, String bcc, 
String subject,
+        String body, String alternative, List attachments)
+    {
+        try {
+            Mail email = new Mail();
+            email.setSubject(subject);
+            email.setFrom(from);
+            email.setTo(to);
+            email.setCc(cc);
+            email.setBcc(bcc);
+            email.setTextPart(alternative);
+            email.setHtmlPart(body);
+            email.setAttachments(attachments);
+            getMailSenderPlugin().sendMail(email, context);
+            return 0;
+        } catch (Exception e) {
+            context.put("error", e.getMessage());
+            getMailSenderPlugin().getLogger().error("sendHtmlMessage", e);
+            return -1;
+        }
+    }
+
+    /**
+     * Sends a simple text plain mail
+     *
+     * @param to the recipient of the message
+     * @param from the sender
+     * @param subject the subject of the message
+     * @param message the body of the message
+     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
+     */
+    public int sendTextMessage(String from, String to, String subject, String 
message)
+    {
+        try {
+            Mail email = new Mail();
+            email.setSubject(subject);
+            email.setTextPart(message);
+            email.setFrom(from);
+            email.setTo(to);
+
+            getMailSenderPlugin().sendMail(email, context);
+            return 0;
+        } catch (Exception e) {
+            context.put("error", e.getMessage());
+            getMailSenderPlugin().getLogger().error("sendTextMessage", e);
+            return -1;
+        }
+    }
+
+    /**
+     * Sends a simple text plain mail with a list of files attachments
+     *
+     * @param to the recipient of the message
+     * @param from the sender
+     * @param cc carbon copy
+     * @param bcc hidden carbon copy
+     * @param subject the subject of the message
+     * @param message the body of the message
+     * @param attachments List of com.xpn.xwiki.api.Attachment that will be 
attached to the mail.
+     * @return 0 on success, -1 on failure. on failure the error message is 
stored in XWiki context
+     */
+    public int sendTextMessage(String from, String to, String cc, String bcc, 
String subject,
+        String message, List attachments)
+    {
+        try {
+            Mail email = new Mail();
+            email.setSubject(subject);
+            email.setTextPart(message);
+            email.setFrom(from);
+            email.setTo(to);
+            email.setCc(cc);
+            email.setBcc(bcc);
+            email.setAttachments(attachments);
+            getMailSenderPlugin().sendMail(email, context);
+            return 0;
+        } catch (Exception e) {
+            context.put("error", e.getMessage());
+            getMailSenderPlugin().getLogger().error("sendTextMessage", e);
+            return -1;
+        }
+    }
+
+    /**
+     * Uses an XWiki document to build the message subject and context, based 
on variables stored in
+     * the VelocityContext. Sends the email.
+     *
+     * @param from Email sender
+     * @param to Email recipient
+     * @param cc Email Carbon Copy
+     * @param bcc Email Hidden Carbon Copy
+     * @param language Language of the email
+     * @param documentFullName Full name of the template to be used (example:
+     * XWiki.MyEmailTemplate). The template needs to have an XWiki.Email 
object attached
+     * @param vcontext Velocity context passed to the velocity renderer
+     * @return True if the email has been sent
+     */
+    public int sendMessageFromTemplate(String from, String to, String cc, 
String bcc,
+        String language, String documentFullName, VelocityContext vcontext)
+    {
+        try {
+            return 
getMailSenderPlugin().sendMailFromTemplate(documentFullName, from, to, cc, bcc,
+                language, vcontext, context);
+        } catch (Exception e) {
+            getMailSenderPlugin().getLogger().error("sendMessageFromTemplate", 
e);
+            return -1;
+        }
+    }
+}

Deleted: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
===================================================================
--- 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
      2007-11-16 10:41:57 UTC (rev 5902)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
      2007-11-16 15:48:57 UTC (rev 5949)
@@ -1,83 +0,0 @@
-package com.xpn.xwiki.plugin.mailsender;
-
-public class MimeTypesUtil
-{
-
-    protected static final String[][] MIME_TYPES =
-        { {"application/mac-binhex40", "hqx"}, {"application/mac-compactpro", 
"cpt"},
-        {"application/msword", "doc"}, {"application/octet-stream", "bin"},
-        {"application/octet-stream", "dms"}, {"application/octet-stream", 
"lha"},
-        {"application/octet-stream", "lzh"}, {"application/octet-stream", 
"exe"},
-        {"application/octet-stream", "class"}, {"application/oda", "oda"},
-        {"application/pdf", "pdf"}, {"application/postscript", "ai"},
-        {"application/postscript", "eps"}, {"application/postscript", "ps"},
-        {"application/powerpoint", "ppt"}, {"application/rtf", "rtf"},
-        {"application/x-bcpio", "bcpio"}, {"application/x-cdlink", "vcd"},
-        {"application/x-compress", "Z"}, {"application/x-cpio", "cpio"},
-        {"application/x-csh", "csh"}, {"application/x-director", "dcr"},
-        {"application/x-director", "dir"}, {"application/x-director", "dxr"},
-        {"application/x-dvi", "dvi"}, {"application/x-gtar", "gtar"},
-        {"application/x-gzip", "gz"}, {"application/x-hdf", "hdf"},
-        {"application/x-httpd-cgi", "cgi"}, {"application/x-koan", "skp"},
-        {"application/x-koan", "skd"}, {"application/x-koan", "skt"},
-        {"application/x-koan", "skm"}, {"application/x-latex", "latex"},
-        {"application/x-mif", "mif"}, {"application/x-netcdf", "nc"},
-        {"application/x-netcdf", "cdf"}, {"application/x-sh", "sh"},
-        {"application/x-shar", "shar"}, {"application/x-stuffit", "sit"},
-        {"application/x-sv4cpio", "sv4cpio"}, {"application/x-sv4crc", 
"sv4crc"},
-        {"application/x-tar", "tar"}, {"application/x-tcl", "tcl"}, 
{"application/x-tex", "tex"},
-        {"application/x-texinfo", "texinfo"}, {"application/x-texinfo", 
"texi"},
-        {"application/x-troff", "t"}, {"application/x-troff", "tr"},
-        {"application/x-troff", "roff"}, {"application/x-troff-man", "man"},
-        {"application/x-troff-me", "me"}, {"application/x-troff-ms", "ms"},
-        {"application/x-ustar", "ustar"}, {"application/x-wais-source", "src"},
-        {"application/zip", "zip"}, {"audio/basic", "au"}, {"audio/basic", 
"snd"},
-        {"audio/mpeg", "mpga"}, {"audio/mpeg", "mp2"}, {"audio/mpeg", "mp3"},
-        {"audio/x-aiff", "aif"}, {"audio/x-aiff", "aiff"}, {"audio/x-aiff", 
"aifc"},
-        {"audio/x-pn-realaudio", "ram"}, {"audio/x-pn-realaudio-plugin", 
"rpm"},
-        {"audio/x-realaudio", "ra"}, {"audio/x-wav", "wav"}, 
{"chemical/x-pdb", "pdb"},
-        {"chemical/x-pdb", "xyz"}, {"image/gif", "gif"}, {"image/ief", "ief"},
-        {"image/jpeg", "jpeg"}, {"image/jpeg", "jpg"}, {"image/jpeg", "jpe"},
-        {"image/png", "png"}, {"image/tiff", "tiff"}, {"image/tiff", "tif"},
-        {"image/x-cmu-raster", "ras"}, {"image/x-portable-anymap", "pnm"},
-        {"image/x-portable-bitmap", "pbm"}, {"image/x-portable-graymap", 
"pgm"},
-        {"image/x-portable-pixmap", "ppm"}, {"image/x-rgb", "rgb"}, 
{"image/x-xbitmap", "xbm"},
-        {"image/x-xpixmap", "xpm"}, {"image/x-xwindowdump", "xwd"}, 
{"text/html", "html"},
-        {"text/html", "htm"}, {"text/plain", "txt"}, {"text/richtext", "rtx"},
-        {"text/tab-separated-values", "tsv"}, {"text/x-setext", "etx"}, 
{"text/x-sgml", "sgml"},
-        {"text/x-sgml", "sgm"}, {"video/mpeg", "mpeg"}, {"video/mpeg", "mpg"},
-        {"video/mpeg", "mpe"}, {"video/quicktime", "qt"}, {"video/quicktime", 
"mov"},
-        {"video/x-msvideo", "avi"}, {"video/x-sgi-movie", "movie"},
-        {"x-conference/x-cooltalk", "ice"}, {"x-world/x-vrml", "wrl"}, 
{"x-world/x-vrml", "vrml"}};
-
-
-    public static String getMimeTypeFromFilename(String filename)
-    {
-        int index = filename.lastIndexOf(".");
-        String extension = filename;
-        if (index != -1) {
-            if (index == filename.length())
-                return ("application/octet-stream");
-            else
-                extension = filename.substring(index + 1);
-        }
-        String type = null;
-        for (int i = 0; i < MIME_TYPES.length; i++) {
-            if (MIME_TYPES[i][1].equals(extension)) {
-               type = MIME_TYPES[i][0];
-               break;
-            }
-        }
-        if (type == null)
-            return ("application/octet-stream");
-        else
-            return (type);
-    }
-    
-    public static void main(String[] args) {
-        String file = "fsd.png";
-        String type = MimeTypesUtil.getMimeTypeFromFilename(file);
-        System.out.println(type);
-    }
-
-}

Copied: 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
 (from rev 5947, 
xwiki-platform/xwiki-plugins/trunk/mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java)
===================================================================
--- 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
                              (rev 0)
+++ 
xwiki-platform/xwiki-plugins/tags/xwiki-plugin-mailsender-1.0/src/main/java/com/xpn/xwiki/plugin/mailsender/MimeTypesUtil.java
      2007-11-16 15:48:57 UTC (rev 5949)
@@ -0,0 +1,101 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.plugin.mailsender;
+
+public class MimeTypesUtil
+{
+    protected static final String[][] MIME_TYPES =
+        { {"application/mac-binhex40", "hqx"}, {"application/mac-compactpro", 
"cpt"},
+        {"application/msword", "doc"}, {"application/octet-stream", "bin"},
+        {"application/octet-stream", "dms"}, {"application/octet-stream", 
"lha"},
+        {"application/octet-stream", "lzh"}, {"application/octet-stream", 
"exe"},
+        {"application/octet-stream", "class"}, {"application/oda", "oda"},
+        {"application/pdf", "pdf"}, {"application/postscript", "ai"},
+        {"application/postscript", "eps"}, {"application/postscript", "ps"},
+        {"application/powerpoint", "ppt"}, {"application/rtf", "rtf"},
+        {"application/x-bcpio", "bcpio"}, {"application/x-cdlink", "vcd"},
+        {"application/x-compress", "Z"}, {"application/x-cpio", "cpio"},
+        {"application/x-csh", "csh"}, {"application/x-director", "dcr"},
+        {"application/x-director", "dir"}, {"application/x-director", "dxr"},
+        {"application/x-dvi", "dvi"}, {"application/x-gtar", "gtar"},
+        {"application/x-gzip", "gz"}, {"application/x-hdf", "hdf"},
+        {"application/x-httpd-cgi", "cgi"}, {"application/x-koan", "skp"},
+        {"application/x-koan", "skd"}, {"application/x-koan", "skt"},
+        {"application/x-koan", "skm"}, {"application/x-latex", "latex"},
+        {"application/x-mif", "mif"}, {"application/x-netcdf", "nc"},
+        {"application/x-netcdf", "cdf"}, {"application/x-sh", "sh"},
+        {"application/x-shar", "shar"}, {"application/x-stuffit", "sit"},
+        {"application/x-sv4cpio", "sv4cpio"}, {"application/x-sv4crc", 
"sv4crc"},
+        {"application/x-tar", "tar"}, {"application/x-tcl", "tcl"}, 
{"application/x-tex", "tex"},
+        {"application/x-texinfo", "texinfo"}, {"application/x-texinfo", 
"texi"},
+        {"application/x-troff", "t"}, {"application/x-troff", "tr"},
+        {"application/x-troff", "roff"}, {"application/x-troff-man", "man"},
+        {"application/x-troff-me", "me"}, {"application/x-troff-ms", "ms"},
+        {"application/x-ustar", "ustar"}, {"application/x-wais-source", "src"},
+        {"application/zip", "zip"}, {"audio/basic", "au"}, {"audio/basic", 
"snd"},
+        {"audio/mpeg", "mpga"}, {"audio/mpeg", "mp2"}, {"audio/mpeg", "mp3"},
+        {"audio/x-aiff", "aif"}, {"audio/x-aiff", "aiff"}, {"audio/x-aiff", 
"aifc"},
+        {"audio/x-pn-realaudio", "ram"}, {"audio/x-pn-realaudio-plugin", 
"rpm"},
+        {"audio/x-realaudio", "ra"}, {"audio/x-wav", "wav"}, 
{"chemical/x-pdb", "pdb"},
+        {"chemical/x-pdb", "xyz"}, {"image/gif", "gif"}, {"image/ief", "ief"},
+        {"image/jpeg", "jpeg"}, {"image/jpeg", "jpg"}, {"image/jpeg", "jpe"},
+        {"image/png", "png"}, {"image/tiff", "tiff"}, {"image/tiff", "tif"},
+        {"image/x-cmu-raster", "ras"}, {"image/x-portable-anymap", "pnm"},
+        {"image/x-portable-bitmap", "pbm"}, {"image/x-portable-graymap", 
"pgm"},
+        {"image/x-portable-pixmap", "ppm"}, {"image/x-rgb", "rgb"}, 
{"image/x-xbitmap", "xbm"},
+        {"image/x-xpixmap", "xpm"}, {"image/x-xwindowdump", "xwd"}, 
{"text/html", "html"},
+        {"text/html", "htm"}, {"text/plain", "txt"}, {"text/richtext", "rtx"},
+        {"text/tab-separated-values", "tsv"}, {"text/x-setext", "etx"}, 
{"text/x-sgml", "sgml"},
+        {"text/x-sgml", "sgm"}, {"video/mpeg", "mpeg"}, {"video/mpeg", "mpg"},
+        {"video/mpeg", "mpe"}, {"video/quicktime", "qt"}, {"video/quicktime", 
"mov"},
+        {"video/x-msvideo", "avi"}, {"video/x-sgi-movie", "movie"},
+        {"x-conference/x-cooltalk", "ice"}, {"x-world/x-vrml", "wrl"}, 
{"x-world/x-vrml", "vrml"}};
+
+
+    public static String getMimeTypeFromFilename(String filename)
+    {
+        int index = filename.lastIndexOf(".");
+        String extension = filename;
+        if (index != -1) {
+            if (index == filename.length())
+                return ("application/octet-stream");
+            else
+                extension = filename.substring(index + 1);
+        }
+        String type = null;
+        for (int i = 0; i < MIME_TYPES.length; i++) {
+            if (MIME_TYPES[i][1].equals(extension)) {
+               type = MIME_TYPES[i][0];
+               break;
+            }
+        }
+        if (type == null)
+            return ("application/octet-stream");
+        else
+            return (type);
+    }
+    
+    public static void main(String[] args) {
+        String file = "fsd.png";
+        String type = MimeTypesUtil.getMimeTypeFromFilename(file);
+        System.out.println(type);
+    }
+
+}

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to