aspose file tools
The moose likes Ant, Maven and Other Build Tools and the fly likes any help how to send emails using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "any help how to send emails using ant " Watch "any help how to send emails using ant " New topic
Author

any help how to send emails using ant

sirisha reddy
Greenhorn

Joined: Oct 29, 2003
Posts: 3
Hi,
I wrote ant script that will compile, make jar file and deploy that jar file to websphere.
I am trying to send emails using ant script ..
When i try to run my ant file using the following command:
c:/> ant -buildfile test.xml
email:
[mail] Sending email: Test build
......
that's it .. it not displaying promt at all ...
which means it is hanging some where ..
Here is my code ..
Any help how to send emails using ant script please ....
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- specify the base directory and default value -->
<project name="test" default="all" basedir=".">
<target name="all" description="send email using ant" >
<mail mailhost="testhome" mailport="1025" subject="Test build">
<from address="malathi.gowda@inc.com"/>
<to address="Vdevmermana@inc.com"/>
<message>The test has completed</message>
</mail>
</target>

</project>
sirisha reddy
Greenhorn

Joined: Oct 29, 2003
Posts: 3
I downloaded mail.jar and activation.jar and copied those two jars into c:/ant/lib
and it is under class path ....
any help how to send emails using ant.
What is wrong in my code ...
thanks.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Mail is a core task in ant, which is opposite to optional tasks. You don't need extra jars.
http://ant.apache.org/manual/CoreTasks/mail.html
sirisha reddy
Greenhorn

Joined: Oct 29, 2003
Posts: 3
Hi,
I solved the mailing problem but i have one more problem.
I can test ejb using junit and jboss successfully.
When running a JUnit test thru jboss the following switches should be passed to the JVM:
-DxPool -DAutoCommit -Djava.security.auth.login.config=c:\jboss-3.2.1\client\auth.conf
But in case of ant where do i set these settings to run EJB.
When I try to run EJB thru ant Script using junit it is giving the following erorr:
Testcase: unknown took 0 sec
Caused an ERROR
Unable to locate a login configuration
java.lang.SecurityException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.getAppConfigurationEntry(ConfigFile.java:221)
at javax.security.auth.login.LoginContext.init(LoginContext.java:176)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:404)
at common.test.EJBTestSetup.setUp(EJBTestSetup.java:56)
at common.test.Test.setUp(Test.java:37)
at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
at junit.extensions.TestSetup.run(TestSetup.java:23)
Here is the code to run ejb using junit thru ant ..
<target name="junit" description="Test " >
<junit printsummary="yes" haltonfailure="yes">
<formatter type="plain"/>
<test name="common.test.Test" haltonfailure="no" outfile="result">
</test>
</junit>
</target>
Any help please ...
Ravi Nistala
Ranch Hand

Joined: Jul 11, 2002
Posts: 93
I am trying to sedn e-mails through ant.It was working with WSAD 5.0.2.But when we updated to WSAD 5.1 + 2 patches.The e-mail is not working.
I was able to find that these 2 versions of WSAD use 2 different versions of ant versiojs.the new wsad used ant V 1.5.3 and the old one soem 1.4... stuff.I included the mail.jar in teh classpath.But still it is complaining about.
"
BUILD FAILED: java.lang.NoClassDefFoundError: com.sun.mail.util.SharedByteArrayInputStream
"
Can soembody help why it is behaving like that.I cansee this file is there in mail.jar .
Anand Wadhwani
Ranch Hand

Joined: Mar 21, 2005
Posts: 151
Did anybody find solution to this problem? I am having same problem. Please help!

TIA.


SCWCD 1.4<br />---------------------<br />Ability is what you're capable of. <br />Motivation determines what you do. <br />Attitude determines how well you do it.<br />---------------------
Mohan G Kumar
Greenhorn

Joined: Feb 17, 2007
Posts: 5
Hi sirisha reddy!! How you have solved that after the line
[mail] Sending email: Test build it was hanging know ? that problem. I am facing same problem. Please help me.. any others faced same problem please provide your inputs on how to solve this problem.....Thanks in Advance
[ March 18, 2007: Message edited by: Mohan Kumar G ]

Mohan G Kumar<br />SCJP(76%), SCWCD(91%), Preparing for SCBCD..
Ramesh Thulasi
Greenhorn

Joined: Apr 20, 2007
Posts: 2
Sirisha Reddy,
Can you please tell me how you solved sending mails via ant.
regards
ramesh thulasi
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: any help how to send emails using ant
 
Similar Threads
urgent help on passing parameters thru ant script
help in creating war/jar file
"include" capability?
MessagingException with Ant mail task
Howto run specific JUnit tests in ant?