Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

any help how to send emails using ant

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ...
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did anybody find solution to this problem? I am having same problem. Please help!

TIA.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sirisha Reddy,
Can you please tell me how you solved sending mails via ant.
regards
ramesh thulasi
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic