? src/main/org/apache/maven/announcement/MailUtils.java
Index: plugin.jelly
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/plugin.jelly,v
retrieving revision 1.11
diff -u -r1.11 plugin.jelly
--- plugin.jelly	22 Jul 2004 11:26:28 -0000	1.11
+++ plugin.jelly	3 Aug 2004 01:46:11 -0000
@@ -40,6 +40,20 @@
     <maven:property var="announcementFile" name="maven.announcement.file" 
         defaultValue="${maven.gen.docs}/announcements/announcement-${versionVariable}.txt"/>
 
+    <maven:property var="maven.announcement.cc" name="maven.announcement.cc" 
+        defaultValue=""/>
+        
+    <!-- If from email address is empty, find the first non empty email 
+         address from the POM. -->
+    <j:if test="${context.getVariable('maven.announcement.mail.from') == null}">
+       <j:forEach var="developer" items="${pom.developers}">
+          <j:if test="${not empty(developer.email)}">
+             <j:set var="maven.announcement.mail.from" value="${developer.email}"/>
+             <j:break/>
+          </j:if>
+       </j:forEach>
+    </j:if>
+
     <!-- Ensure the directory where the announcement will be created exists -->
     <ant:dirname property="announcementDir" file="${announcementFile}"/>
     <ant:mkdir dir="${announcementDir}"/>
@@ -49,6 +63,8 @@
     <maven:property var="distributionUrl" name="maven.announcement.distributionUrl" 
         defaultValue="${maven.repo.remote}/${pom.groupId}/plugins"/>
 
+    <j:useBean var="stringUtils" class="org.apache.commons.lang.StringUtils"/>
+
   </goal>
 
   <goal name="announcement:check-version" prereqs="announcement:init">
@@ -97,6 +113,13 @@
     
   </goal>
 
+  <goal name="announcement:mail" prereqs="announcement:generate"
+    description="Send an email containing the release announcement">
+
+    <announcement:mail file="${announcementFile}"/>
+
+  </goal>
+
   <!-- Define common jelly script used by different goals as a jelly tag -->
   <define:taglib uri="announcement">
     <define:tag name="generate">
@@ -118,6 +141,33 @@
       </j:file>
 
     </define:tag>
+
+    <define:tag name="mail">
+      <!-- @file: Announcement file location -->
+
+      <maven:param-check value="${maven.announcement.mail.server}" fail="true">The SMTP server name must be specified using the maven.announcement.mail.server property</maven:param-check> 
+      <maven:param-check value="${maven.announcement.mail.from}" fail="true">The From address must be specified using the maven.announcement.mail.from property or by ensuring that at least one developer in the POM has an email address specified</maven:param-check> 
+      <maven:param-check value="${maven.announcement.mail.to}" fail="true">The To address must be specified using the maven.announcement.mail.to property</maven:param-check> 
+      
+      <!-- Resolve dynamic %% templates from maven.announcement.mail.subject -->
+      <j:set var="maven.announcement.mail.subject"
+          value="${stringUtils.replace(context.getVariable('maven.announcement.mail.subject'), '%VERSION%', versionVariable)}"/>
+      
+      <echo>Sending mail using server "${maven.announcement.mail.server}", subject "${maven.announcement.mail.subject}"...</echo>
+      <echo>Sending from "${maven.announcement.mail.from}" to "${maven.announcement.mail.to}"...</echo>
+
+      <util:loadText uri="file:${file}" var="announcementContent"/>
+      <j:invokeStatic className="org.apache.maven.announcement.MailUtils" method="sendMail">
+          <j:arg type="java.lang.String" value="${maven.announcement.mail.server}"/>
+          <j:arg type="java.lang.String" value="${maven.announcement.mail.from}"/>
+          <j:arg type="java.lang.String" value="${maven.announcement.mail.to}"/>
+          <j:arg type="java.lang.String" value="${maven.announcement.mail.cc}"/>
+          <j:arg type="java.lang.String" value="${maven.announcement.mail.subject}"/>
+          <j:arg type="java.lang.String" value="${announcementContent}"/>
+      </j:invokeStatic>
+
+    </define:tag>
+
   </define:taglib>
 
 </project>
Index: plugin.properties
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/plugin.properties,v
retrieving revision 1.11
diff -u -r1.11 plugin.properties
--- plugin.properties	22 Jul 2004 11:26:28 -0000	1.11
+++ plugin.properties	3 Aug 2004 01:52:28 -0000
@@ -33,3 +33,19 @@
 
 # Stylesheet to use to generate the text announcement
 maven.announcement.stylesheet.path = ${plugin.resources}/announcement.jsl
+
+# IP address or name of the SMTP server used to send an announcement email
+# maven.announcement.mail.server = 
+
+# From address to use when sending an announcement email. If not defined, 
+# the first email address found in the POM will be used.
+# maven.announcement.mail.from =
+
+# Comma-separated list of To addresses to use when sending an announcement email.
+# maven.announcement.mail.to =
+
+# Comma-separated list of CC addresses to use when sending an announcement email.
+# maven.announcement.mail.cc =
+
+# Mail subject to use when sending an announcement email.
+maven.announcement.mail.subject = [ANN] ${pom.name} %VERSION% released
Index: project.xml
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/project.xml,v
retrieving revision 1.25
diff -u -r1.25 project.xml
--- project.xml	15 Jul 2004 19:19:48 -0000	1.25
+++ project.xml	3 Aug 2004 01:52:30 -0000
@@ -87,5 +87,15 @@
       <version>20030211.142705</version>
       <url>http://jakarta.apache.org/commons/jelly/libs/xml/</url>
     </dependency>
+    <dependency>
+      <id>commons-lang</id>
+      <version>2.0</version>
+      <url>http://jakarta.apache.org/commons/lang/</url>
+    </dependency>
+    <dependency>
+      <id>commons-net</id>
+      <version>1.2.1</version>
+      <url>http://jakarta.apache.org/commons/net/</url>
+    </dependency>
   </dependencies>
 </project>
Index: xdocs/changes.xml
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/xdocs/changes.xml,v
retrieving revision 1.21
diff -u -r1.21 changes.xml
--- xdocs/changes.xml	22 Jul 2004 11:26:28 -0000	1.21
+++ xdocs/changes.xml	3 Aug 2004 01:54:02 -0000
@@ -25,6 +25,10 @@
   </properties>
   <body>
     <release version="1.3-SNAPSHOT" date="in CVS">
+      <action dev="vmassol" type="add" issue="MPANNOUNCEMENT-9" due-to="Felipe Leme">
+        Added new <code>announcement:mail</code> goal to automatically
+        send the generated announcement by email.
+      </action>
       <action dev="vmassol" type="add" issue="MPANNOUNCEMENT-11" due-to="Felipe Leme">
         Added new optional <code>maven.announcement.stylesheet.path</code>property 
         that defines what stylesheet to use to generate the text announcement.
Index: xdocs/goals.xml
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/xdocs/goals.xml,v
retrieving revision 1.4
diff -u -r1.4 goals.xml
--- xdocs/goals.xml	2 Jul 2004 20:57:16 -0000	1.4
+++ xdocs/goals.xml	3 Aug 2004 01:54:02 -0000
@@ -47,6 +47,11 @@
             Generate a release announcement in text format for all releases 
             found in <code>changes.xml</code>
           </td>
+        <tr>
+          <td>announcement:mail</td>
+          <td>
+            Send the generated announcement message by email.
+          </td>
         </tr>
       </table>
     </section>
Index: xdocs/properties.xml
===================================================================
RCS file: /home/cvspublic/maven-plugins/announcement/xdocs/properties.xml,v
retrieving revision 1.9
diff -u -r1.9 properties.xml
--- xdocs/properties.xml	22 Jul 2004 11:26:28 -0000	1.9
+++ xdocs/properties.xml	3 Aug 2004 01:54:07 -0000
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
+
 <!-- 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -69,6 +70,53 @@
           </td>
           <td>
             <code>${plugin.resources}/announcement.jsl</code>
+          </td>
+        </tr>
+        <tr>
+          <td>maven.announcement.mail.server</td>
+          <td>Required for announcement:mail goal</td>
+          <td>
+            Address of the SMTP server used to send the email message.
+          </td>
+          <td>
+          </td>
+        </tr>
+        <tr>
+          <td>maven.announcement.mail.subject</td>
+          <td>Yes</td>
+          <td>
+            Subject of the announcement email message.
+          </td>
+          <td>
+            <code>[ANN] ${pom.name} %VERSION% released</code>
+          </td>
+        </tr>
+        <tr>
+          <td>maven.announcement.mail.from</td>
+          <td>Yes</td>
+          <td>
+            Sender (email address) of the announcement message.
+          </td>
+          <td>
+            First developer email found in the POM
+          </td>
+        </tr>
+        <tr>
+          <td>maven.announcement.mail.to</td>
+          <td>Required for announcement:mail goal</td>
+          <td>
+            Comma-separated list of To: address used as recipients of the announcement message.
+          </td>
+          <td>none
+          </td>
+        </tr>
+        <tr>
+          <td>maven.announcement.mail.cc</td>
+          <td>Yes</td>
+          <td>
+            Comma-separated list of CC address used as recipients of the announcement message.
+          </td>
+          <td>none
           </td>
         </tr>
       </table>

