ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "heliquan" <heliq...@kingdee.com>
Subject ANT :use ant send mail in java code occur erro
Date Mon, 11 Dec 2006 03:08:38 GMT
 
 Hi,
   I use ant in java code to send e-mail,but some error I can't find the
solution.
 In java code ,I had new a "org.apache.tools.ant.taskdefs.email.EmailTask"
class  object to send  email,
but occur an "454 5.7.3 Client was not authenticated."excption. 
 
The java code like this:
    Project pj=new Project();
    pj.init();
    Target tg=new Target();
    tg.setName("mail");    
    tg.setProject(pj);
    pj.addTarget(tg);
    EmailTask mail=new EmailTask();    
    mail.setMailhost("192.168.16.2");
    mail.setMailport(25);
    mail.setUser("build");
    mail.setPassword("easbuildmail");
    mail.setFrom("build@kdsv.kingdee.com");
    mail.setToList("liujiping@kdsv.kingdee.com");
    mail.setMessage("test mail");
    mail.setSubject("subject");    
    mail.setProject(pj);
    tg.addTask(mail);    
    tg.performTasks();
    tg.execute();
 
If i run the code,it would be throw the following exception :
 
IO error sending mail
 at
org.apache.tools.ant.taskdefs.email.PlainMailer.send(PlainMailer.java:92)
 at
org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:556)
 at org.apache.tools.ant.Task.perform(Task.java:364)
 at org.apache.tools.ant.Target.execute(Target.java:301)
 at org.apache.tools.ant.Target.performTasks(Target.java:328)
 at com.kingdee.kbs.views.MailTest.main(MailTest.java:46)
Caused by: java.io.IOException: Unexpected reply to command: MAIL FROM:
<build@kdsv.kingdee.com>: 454 5.7.3 Client was not authenticated.
 at org.apache.tools.mail.MailMessage.send(MailMessage.java:445)
 at org.apache.tools.mail.MailMessage.sendFrom(MailMessage.java:415)
 at org.apache.tools.mail.MailMessage.from(MailMessage.java:195)
 at
org.apache.tools.ant.taskdefs.email.PlainMailer.send(PlainMailer.java:44)
 ... 5 more
--- Nested Exception ---
java.io.IOException: Unexpected reply to command: MAIL FROM:
<build@kdsv.kingdee.com>: 454 5.7.3 Client was not authenticated.
 at org.apache.tools.mail.MailMessage.send(MailMessage.java:445)
 at org.apache.tools.mail.MailMessage.sendFrom(MailMessage.java:415)
 at org.apache.tools.mail.MailMessage.from(MailMessage.java:195)
 at
org.apache.tools.ant.taskdefs.email.PlainMailer.send(PlainMailer.java:44)
 at
org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:556)
 at org.apache.tools.ant.Task.perform(Task.java:364)
 at org.apache.tools.ant.Target.execute(Target.java:301)
 at org.apache.tools.ant.Target.performTasks(Target.java:328)
 at com.kingdee.kbs.views.MailTest.main(MailTest.java:46)
Exception in thread "main" 
 
The user,password,hostip value ware right which in the java code,use a xml
file with the same value to call ant.bat,it would be ok.My os is windows
2003, the ant version is 1.6.1 and the jdk version is 1.4.2_11.
   What can I doing ? Can you help me? 
 

 Best regard 
                                                       yours,
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message