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 Shal Jain <sh...@intertechsys.com> on 2003/07/01 17:45:10 UTC

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, someone@someplace.com);
   }
 }



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">
           <processor>error</processor>
     </mailet>
  ...
  --- rest of the transport processort block -->
 </processor>







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


Re: Mailet question

Posted by Kenny Smith <ja...@journalscape.com>.
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:shal_jain@intertechsys.com]
>>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, someone@someplace.com);
>>   }
>> }
>>
>>
>>
>>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">
>>           <processor>error</processor>
>>     </mailet>
>>  ...
>>  --- rest of the transport processort block -->
>> </processor>
>>
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: james-user-help@jakarta.apache.org


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


RE: Mailet question

Posted by Danny Angus <da...@apache.org>.
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:shal_jain@intertechsys.com]
> 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, someone@someplace.com);
>    }
>  }
> 
> 
> 
> 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">
>            <processor>error</processor>
>      </mailet>
>   ...
>   --- rest of the transport processort block -->
>  </processor>
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
>