Ruchi,
Here is the syntax of the target I use to send out email in case my junit
tests fail. Following that is a modified target for you, if a build fails
<target name="send-report-failure-junit" if="junit.failed"
depends="unit-test-report">
<mail
messageMimeType="text/html"
files="${build}/test/reports/junit-noframes.html" "
from="[EMAIL PROTECTED]
tolist="[EMAIL PROTECTED]"
mailhost="belovedexchangeserver.com"
subject="JUnit Test Results: ${TODAY}"
/>
</target>
<target name="send-report-failure-build" if="build.failed"
depends="unit-test-report">
<mail
messageMimeType="text/html"
files="build.xml"
from="${admin.qa}"
tolist="${list.fail}"
mailhost="${mail.host}"
subject="Build Failure Notification: ${TODAY}"
/>
</target>
Notes:
1. I'm using ant 1.5
2. To troubleshoot sending mail try the following:
- ping, traceroute, etc to ascertain packets can be sent to the server
- send the file as an attachment, or try sending a different x.txt file
3. I use properties for each value, eg. tolist="${list.failure}", etc. this
makes maintenance a lot easier
4. If all else fails, simply use blat (shareware) with which you can
register the mail server of your choice. You can then write a simple batch
file, and execute it from ant.
Hope this helps,
Haneef.
PS: If all else fails still, just hope that S. Francis doesn't do your
Performance Review :->
-----Original Message-----
From: Ruchi Agarwal
To: [EMAIL PROTECTED]
Sent: 10/18/02 1:35 AM
Subject: Hi... just joined the list 'cos of this problem.
Hi,
I want to use the mail target in my project
But facing some problem
Error saying **********
Buildfile: a.xml
init:
[mail] Sending email: Test build
[mail] Failed to send email
BUILD FAILED
file:D:/test/a/a.xml:15: Problem while sending mime mail:
Total time: 2 seconds
The code that I've written for this prpose is
<mail mailhost="172.22.12.168" mailport="1025" subject="Test build">
<from address="[EMAIL PROTECTED]"/>
<to address="[EMAIL PROTECTED]"/>
<message>The nightly build has completed</message>
</mail>
and along with that, I've already included the required jars (mail.jar
and
activation.jar)
is there any other setting required ???
please help me.
Thanks in anticipation.
Regards,
Ruchi AgarwalNOTICE: This E-mail may contain confidential information. If
you are not the addressee or the intended recipient please do not read this
E-mail and please immediately delete this e-mail message and any attachments
from your workstation or network mail system. If you are the addressee or
the intended recipient and you save or print a copy of this E-mail, please
place it in an appropriate file, depending on whether confidential
information is contained in the message.