ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: ANT :use ant send mail in java code occur erro
Date Tue, 12 Dec 2006 13:22:26 GMT
I would think and authentication error implies the wrong user name
and/or password.

Have you tried to output the values of both prior sending the email?

heliquan wrote:
>  
>  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,
>  
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message