Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
ANT auto-emailing of reports, mail task

ANT auto-emailing of reports, mail task

2007-07-05       - By Hankel
Reply:     1     2  

Hi there,

Once again, I apologize for posting a question more related on ANT than
TestNG. But as far as I know, there is no such active and populated forums
for ANT, shame.

However, I think this subject would benefit from a large group of TestNG
users here, as automated tests suggested by TestNG take all its advantage
and sense with automating the emailing process.

To start with, here is the Apache ANT documenation on the Mail task. It
seems that mail also supports SSL secure protocol, so that's fine for the
vast majority of mail service providers.

So here is my ANT target that causes me harm....

<target name="email-report" description="Email auto-generated REPORT">

<mail messagemimetype="text/plain" ssl="on" mailhost=""
mailport="465" user="addr1@(protected)" password="XXX" subject="Testing
Environment - TestNG report">
<from address="addr1@(protected)"/>
<to address="receiver@(protected)"/>
<message>The ${scenario} nightly build is completed, on date: ${DateStamp}.
Find the auto-generated report file attached.</message>
<fileset dir="Run\${scenario}\${DateStamp}">
<include name="emailable-report.html"/>


So as you can see I am using gmail as a mail server, with my personal
account (addr1@) which will connect to the smtp gmail server to send the
attached report file to receiver@(protected)

Now I am wondering what am I doing wrong to get this odd result:

[mail] Sending email: Testing Environment - TestNG report
[mail] Failed to send email: Could not connect to SMTP host:,
port: 465

Unfortunately for me, I cannot count on more precisions about the failure.
The only thing I know is that the email has not been sent so far.

ANT's task "mail" is based on the Sun Java Activation Framework and the
(Mime)Mail archive. So I downloaded both the mail.jar and activation.jar
from Java Sun website, and placed them in the ANT\lib directory.

I also found some guidelines to use the <mimemail> ANT's task, which uses
JUnitMail.jar which is in the ANT\lib directory by default.

Cannot have it working either.
I was wondering if there was some proxy issues in there...

EDIT >>>

Using telnet's open command, it's giving me the "could not
connect to" error. It might be a proxy or security problem I guess.

Does anybody know how to set up a proxy within the mail task? How do we
manage the connections to external servers, such as gmail for example?
Can you react to that poll and leave your feedbacks and experience with the
ANT "mail" task (Java Sun mail.jar & activation.jar).

Thank you.
View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.