Simplest Enterprise Continuous Integration Solutions

Saturday, September 11, 2010

Apache Ant Mail Task

mail_build.xml Ant buildfile contains below contents:
<project name="ant_mail" default="all">
   <target name="mail">
      <mail mailhost="smtp.acme.com" mailport="25" subject="[Ant Mail Notification]: ${my_ant_mail_subject}"
         from="me@acme.com"
         tolist="somebody1@acme.com,some_group1@acme.com"
         cclist="somebody2@acme.com,somegroup2@acme.com"
         encoding="mime" messagemimetype="text/html">
         <message>${my_ant_mail_subject} bla bla =<br><br>
         Regards,<br>
         </message>
      </mail>
   </target>
</project>

Invoked as: 
<full_path_to>/ant -buildfile <full_path_to>/mail_build.xml mail -Dmy_ant_mail_subject="My Email Subject"

Note:
mail.jar and activation.jar existences may require in Ant installation lib folder.

No comments:

Post a Comment