thank God tobe for replying to my question..really thought nobody was replying when what actually happened was most of my emails went to bulk mail folder..don't know why.. anyway here's the code for UnavailableMessageSave. actually i got all this from http://www-106.ibm.com/developerworks/java/library/j-james2.html 
actually what i'm actually trying to do is:
1) when Apache James receive any email, instead of it deliver the email to the intended recipient, it will just store the email in the server and no more processing of the email should be done.
2) then Apache James would email the (should be) recipient of the email a message saying that he/she have got an email...
 
hope you understand my question..really need someone to help me since I've been at this thing for more than a week...thanx again for helping..
 
--------------------------------------------------------------------------------------------------------------------------------
Note the way we deal with exceptions. The log() method is used to ensure that problems are reported, but you'll have to check the logs if you don't see the behavior you expected. Also, notice that we set the state for the e-mail to GHOST. This stops processing on the sent e-mail, because we'll be storing it ourselves and no additional action is required by the e-mail server.
Listing 5. UnavailableMessageSave: Saving messages sent to [EMAIL PROTECTED]

package com.claudeduguay.mailets;

import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import org.apache.mailet.*;

public class UnavailableMessageSave
  extends UnavailableMessageBase
{
  protected String subject;
  protected String content;
  
  public void init(MailetConfig config)
    throws MessagingException
  {
    super.init(config);
    subject = getInitParameter("subject");
    content = getInitParameter("content");
  }
  
  public void service(Mail mail)
    throws MessagingException
  {
    MailAddress sender = mail.getSender();
    Collection recipients = mail.getRecipients();
    MailAddress address = getFirstAddress(recipients);
    MailetContext context = getMailetContext();
    try
    {
      MimeMessage msg = (MimeMessage)mail.getMessage();
      store.storeMessage(sender, msg);
      mail.setState(Mail.GHOST);
    }
    catch (IOException e)
    {
      log("Unable to store user message", e);
    }
    try
    {
      MimeMessage msg = createMessage(address, sender, subject, content);
      Collection target = addressAsCollection(sender);
      context.sendMail(address, target, msg);
    }
    catch (MessagingException e)
    {
      log("Unable to send confirmation message", e);
    }
  }
}


tobe <[EMAIL PROTECTED]> wrote:
Where do the e-mails actually go that you send from your
UnavailableMessageSave?

/tobe


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger

Reply via email to