If i use:
getMailetContext().sendMail(mail.getSender(), new
MailAddress[]{recipient}.asList(), message, "testProcessor");

i get:
Cannot invoke asList() on the array type MailAddress[]

i have found the error.. it was a ClassCast exception .. logged in spool
log.


I cast the mail.getMessage(); to MimeMessage cause i want to add headers
and save them after that:


MimeMessage message = newMail.getMessage();

message.addHeader("X-User", user);
message.addHeader("X-Domain", domain);
message.saveChanges();

I also have removed the mail.setAttributes(); methods. cause the values
get lost afet send the message .. 

So i want add the headers and get the values i need later out of the
headers.

bye






Am Dienstag, den 28.02.2006, 10:49 +0100 schrieb Stefano Bagnara:
> Norman Maurer wrote:
> > Ok just did it but if i set the processor with setstat or with passing
> > it directly in the sendMail() method it get sorred in error dir:
> 
> What is the error that place it into error?
> 
> > Here is what i did:
> > 
> > SplitDomain mailet snip:
> > 
> >     public void service(Mail mail) throws MessagingException
> >     {
> >         Collection recipients = mail.getRecipients();
> > 
> >         for (Iterator i = recipients.iterator(); i.hasNext();)
> >         {
> >             Mail newMail = mail;
> >             MailAddress recipient = (MailAddress) i.next();
> > 
> >             user = recipient.toString().toLowerCase();
> >             domain = recipient.getHost().toString().toLowerCase();
> >             senderUser = mail.getSender().toString().toLowerCase();
> >             senderDomain =
> > mail.getSender().getHost().toString().toLowerCase();
> > 
> >             newMail.setAttribute(DOMAIN_MAIL_ATTRIBUTE_NAME, domain);
> >             newMail.setAttribute(USER_MAIL_ATTRIBUTE_NAME, user);
> >             newMail.setAttribute(SENDER_DOMAIN_MAIL_ATTRIBUTE_NAME,
> > senderDomain);
> >             newMail.setAttribute(SENDER_USER_MAIL_ATTRIBUTE_NAME,
> > senderUser);
> 
> You don't need to sent this attributes: the mail sender and recipients 
> will be there.
> 
> >             getMailetContext().sendMail(mail.getSender(), recipients,
> > (MimeMessage) newMail,"testProcessor");
> 
> You should send each mail to the single recipient.
> So put here a single "recipient" and not "recipients" or it won't work 
> correctly.
> ---------------
> for (.....) {
>       MailAddress recipient = (MailAddress) i.next();
>       getMailetContext().sendMail(mail.getSender(), new 
> MailAddress[]{reciepient}.asList(),mail.getMessage(),"testProcessor").
> }
> -------------
> 
> I don't understand why you cast Mail to MimeMessage: that's wrong.
> Mail.getMessage() will give you the message.
> 
> > So the prob must be the SplitMail mailet.. what im doing wrong ?
> 
> If a mail goes to "error" James should log an error: Look in the logs.
> 
> Stefano
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to