RE: Mailet question

2003-07-01 Thread Danny Angus
you have to send the mail using the mailet context, and GHOST the original so that 
it re-enters from the top, alternatively copy the message and send that in a new mail 
to the cc recipient.

Mail message headers *don't* control the recipients of the email, strange but true. 

d.

 -Original Message-
 From: Shal Jain [mailto:[EMAIL PROTECTED]
 Sent: 01 July 2003 16:45
 To: James Users List
 Subject: Mailet question
 
 
 James vers 2.1.2
 OS - Win2K
 
 I have a mailet that monitors all outbound messages and under certain
 conditions adds a CC recipient
 I know the mailet executes because the headers of the outbound 
 messages show
 the added CC recipient address.
 However, the message is not delivered to this special address.
 The SMTP log shows message being spooled to all other recipients 
 (to/cc/bcc)
 except for the one that I added
 
 I am including the service method as well as the changes to the config.xml
 file.
 
 What am I missing ?
 
 
 
 
 The service method looks somewhat like this
 
 
   public void service(Mail mailObj) throws javax.mail.MessagingException
   {
 MimeMessage msg = mailObj.getMessage();
 boolean evalSuccess = evalConditions();
if (evalSuccess)
{
msg.addRecipients(Message.RecipientType.CC, [EMAIL PROTECTED]);
}
  }
 
 
 
 In the config file the the mailet has been configured at the very begining
 of the transport processor
 
   processor name=transport
 
 !-- add custom address to the CC List --
 mailet match=All class=CCSender /-- my mailet
 
 !-- Is the recipient is for a local account, deliver it locally --
 mailet match=RecipientIsLocal class=LocalDelivery/
 
 !-- If the host is handled by this server and it did not get --
 !-- locally delivered, this is an invalid recipient --
 mailet match=HostIsLocal class=ToProcessor
processorerror/processor
  /mailet
   ...
   --- rest of the transport processort block --
  /processor
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

Re: Mailet question

2003-07-01 Thread Kenny Smith
Here is a snippet from JDBCVirtualUserTable that does this kind of 
thing, so you know where to start searching:

getMailetContext().sendMail(mail.getSender(), recipientsToAddForward, 
mail.getMessage());

recipientsToAddForward is a Collection of MailAddress(es).

Kenny Smith
JournalScape.com
Danny Angus wrote:
you have to send the mail using the mailet context, and GHOST the original so that it re-enters from the top, alternatively copy the message and send that in a new mail to the cc recipient.

Mail message headers *don't* control the recipients of the email, strange but true. 

d.


-Original Message-
From: Shal Jain [mailto:[EMAIL PROTECTED]
Sent: 01 July 2003 16:45
To: James Users List
Subject: Mailet question
James vers 2.1.2
OS - Win2K
I have a mailet that monitors all outbound messages and under certain
conditions adds a CC recipient
I know the mailet executes because the headers of the outbound 
messages show
the added CC recipient address.
However, the message is not delivered to this special address.
The SMTP log shows message being spooled to all other recipients 
(to/cc/bcc)
except for the one that I added

I am including the service method as well as the changes to the config.xml
file.
What am I missing ?



The service method looks somewhat like this

 public void service(Mail mailObj) throws javax.mail.MessagingException
 {
   MimeMessage msg = mailObj.getMessage();
   boolean evalSuccess = evalConditions();
  if (evalSuccess)
  {
  msg.addRecipients(Message.RecipientType.CC, [EMAIL PROTECTED]);
  }
}


In the config file the the mailet has been configured at the very begining
of the transport processor
 processor name=transport

   !-- add custom address to the CC List --
   mailet match=All class=CCSender /-- my mailet
   !-- Is the recipient is for a local account, deliver it locally --
   mailet match=RecipientIsLocal class=LocalDelivery/
   !-- If the host is handled by this server and it did not get --
   !-- locally delivered, this is an invalid recipient --
   mailet match=HostIsLocal class=ToProcessor
  processorerror/processor
/mailet
 ...
 --- rest of the transport processort block --
/processor






-
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]


RE: mailet question

2002-09-20 Thread Noel J. Bergman

A plan is for future version of the Mail interface to support attributes.
That might help you.

--- Noel

-Original Message-
From: Stefano Debenedetti [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 11:53
To: James Users List
Subject: Re: mailet question


Brian 'Bex' Huff wrote:
 Now, is there any easy way in the java code to ask what matcher caused
 this mailet to be executed and why ?

I would need that too, I think the only way right now is to have your
matcher set up an attribute in the MailetContext that you mailet can
later retrieve but doesn't look very easy to me because of
multithreading issues

ciao
ste


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


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




Re: Mailet Question

2001-06-30 Thread Marc Chamberlin
Title: Mailet Question



Ah, a question I feel confident enough to answer! 
;-) (I mostly lurk myself and ask questions once in a while, so maybe I can pay 
back a bit...)

Since you are refering to a bat file, I presume you 
are working in a Windows environment.. So, the answer to your question is a 
qualified yes First, of course, you will have to write a mailet to be 
invoked when one of your matchers recognizes wherethe email came from. The 
James documentation describes the process of writing mailets and 
matchers,and installing them in the James server, and it is not to 
difficult of a procedure to follow

If you were to execute a straight forward 
executable file, you could execute it from a mailet, using the Java 
Runtime.exec() call from within your mailet code... However, bat files are 
usually interpreted by the Windows interpreter so the process becomes more 
difficult... Instead of trying to guide you through the necessary steps here, I 
will refer you to an excellent article at the following URL which goes into the 
details... http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

I don't have an example of doing exactly what you 
want to do, but have been through enough pain of writing Java code which invokes 
external processes that I had this URL bookmarked in all my browsers! It has 
been a lifesaver... ;-)

 Marc Chamberlin


  - Original Message - 
  From: 
  Bernstein, Marc 
  (Marc) 
  To: [EMAIL PROTECTED] 
  
  Sent: Saturday, June 30, 2001 7:39 
  AM
  Subject: Mailet Question
  
  I am looking to have JAMES automatically run a bat file when 
  an incoming email matches a predetermined criteria. 
  Example: If email is from "[EMAIL PROTECTED]" run "c:\test.bat". 
  
  Is this possible? Does anyone have a similar 
  example? 
  Thanks, Marc Bernstein