You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Steen Jansdal <sj...@buanco.dk> on 2003/04/28 12:15:10 UTC
Fetch pop'ing mails with 'Newsgroup' header fails
Hi,
I'm fetch pop'ing some mails, and when there is a 'Newsgroup'
header is fails with the following error in scheduler.log
28/04/03 08:34:15 WARN scheduler: Error occured executing trigger
sja@buanco.dk
java.lang.ClassCastException: javax.mail.internet.NewsAddress
at org.apache.james.James.sendMail(James.java(Compiled Code))
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java(Compiled
Code))
at $Proxy9.sendMail(Unknown Source)
at
org.apache.james.fetchpop.FetchPOP.targetTriggered(FetchPOP.java(Compiled
Code))
at
org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler.doRunEntry(DefaultTimeScheduler.java(Compiled
Code))
at
org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler$1.run(DefaultTimeScheduler.java(Compiled
Code))
at
org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler$1.run(DefaultTimeScheduler.java(Compiled
Code))
at
org.apache.avalon.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnable.java(Compiled
Code))
at
org.apache.avalon.excalibur.thread.impl.WorkerThread.run(WorkerThread.java:80)
I think that it could be fixed with:
public void sendMail(MimeMessage message) throws MessagingException {
MailAddress sender = new
MailAddress((InternetAddress)message.getFrom()[0]);
Collection recipients = new HashSet();
Address addresses[] = message.getAllRecipients();
for (int i = 0; i < addresses.length; i++) {
// Add the following test
if ( addresses[i] instanceof InternetAddress )
recipients.add(new MailAddress((InternetAddress)addresses[i]));
}
sendMail(sender, recipients, message);
}
Best regards
Steen Jansdal
---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org