This post has a video that explains how to you use ANT to email your source code and or swf (or .air) file to the client (if you need to). It even involves how to zip the project up using ANT as well.

To use email with ant you need the following 3 jar files installed.

After you download the files you need to put them into your ant directory under your eclipse install “/plugins/org.apache.ant_******/ folder. If you watch the video, I explain how to find the ant folder if you don’t know where it is. For me it is “C:\Program Files\Adobe\Flex Builder 3\plugins\org.apache.ant_1.7.0.v200706080842\lib”. That is where all the ant jar files are held. You need to put the jar’s you downloaded into that folder, and then in eclipse you need to do the following.

  1. Window > Preferences > (on left tree) Ant > Runtime
  2. Once you’ve clicked on “Runtime” you’ll see a tree in the right side and the first entry should say “Ant Home Entries(Default) you need to click that, and then all of the buttons on the right will become enabled to click on
  3. click on “Add External JARs
  4. browse to your ant directory where all the jars are (for me its C:\Program Files\Adobe\Flex Builder 3\plugins\org.apache.ant_1.7.0.v200706080842\lib)
  5. highlight your jar files that you downloaded and click ok (ant-javamail.jar,activation.jar,mail.jar)
  6. click apply
  7. restart flex builder or eclipse (whichever you are using)

Now we are finally ready to get into the ANT part…

Start by going into whatever flex project you want (or creating one) and then create two files under the root.

project.properties
##### EMAIL PROPERTIES #####
email.server = smtp.gmail.com
email.ssl = true
email.user = someemail@gmail.com
email.from = someemail@gmail.com
email.password = myReallyStrongPassword
email.to = someemail@gmail.com
email.port = 465

##### ZIP PROPERTIES #####
zip.destinationFile = E:/fb3Workspace/TempPublish/${zip.filename}.zip
zip.filename = src-code
zip.dir = E:/fb3Workspace/TempPublish/src

Build.xml
<project name="Publishing your project via Email with ANT">


<property file="project.properties" />

<target name="mail-project-to-client" depends="zip-project, send-email" />

<target name="send-email">
<mail
tolist = "${email.to}"
from = "${email.from}"
subject = "New Version of file"
mailhost = "${email.server}"
mailport = "${email.port}"
ssl = "${email.ssl}"
user = "${email.user}"
password = "${email.password}"
messagemimetype = "text/html"
>
<message><![CDATA[
<p>
this is my html message you have a new zip file attached
</p>
]]>
</message>
<fileset file="${zip.destinationFile}">
<exclude name="**/*.svn"/>
</fileset>
</mail>
</target>

<target name="zip-project">
<zip destfile="${zip.destinationFile}" duplicate="preserve">
<zipfileset dir="${zip.dir}" />
</zip>
</target>
</project>

Please see the video for more detail.

Pushing your project via Email with ANT (takes a little bit to load)

NOTE:Please note that the zip format allows multiple files of the same fully-qualified name to exist within a single archive. This has been documented as causing various problems for unsuspecting users. If you wish to avoid this behavior you must set the duplicate attribute to a value other than its default, “add”. (zip tag documentation)

Links: