Hello 

I am using james 2.3.2, so excuse me if this may have changed to james 3.0.

For logging you could enter a "LogMessage" mailet.
         <mailet match="All" class="LogMessage">
           <headers>true</headers>
           <body>true</body>
           <comment>"Received mail"</comment>
         </mailet> 
before and after your mailet.

Your smtp log shows one mail with two recipients (RCPT-TO) in the envelope.

Have a look at your james log, and look at the Mail IDs.
James receives a mail
Mail1455180345460-b0c7ee8a-37b5-42c9-8a76-8db5ef94ef33

But this is not the object which is delivered. Delivered ist:
- Mail1455180345460-b0c7ee8a-37b5-42c9-8a76-8db5ef94ef33-!840585-!228865
And
- Mail1455180345460-b0c7ee8a-37b5-42c9-8a76-8db5ef94ef33-to-example.jp
So it has been split, I think, by james. Before or after your mailet? I don't 
know.
 
I agree: it is unclear why it is not handled as expected.
Or excatly: why no "Pass-Through" mail exists. Maybe because of the splitting.
Maybe a bug, I don't know.

You may try something like:
<mailet match="RecipientIs=k...@example.org, kyle.example.jp" class="Forward">
   <forwardTo>kyle-c...@example.org</forwardTo>
   <passThrough>true</passThrough>
</mailet>
But only to see if this will change something, cause this is definitvly wrong.


Greetings
Bernd



-----Ursprüngliche Nachricht-----
Von: Kohei Nozaki [mailto:k...@bridge9.sakura.ne.jp] 
Gesendet: Donnerstag, 11. Februar 2016 12:38
An: server-user@james.apache.org
Betreff: Re: AW: How to forward email, but left a copy in original address? 
[unsigned]

Hi Bernd, thanks for the reply.

I used Thunderbird to send the mail. as for your concern about splitting 
email, I've acquired SMTP log of Thunderbird so I can check it.

I've confirmed that it sent two "RCPT TO" message to James sequentially, 
in one SMTP session. I've pasted the log to gist (actual email addresses 
or domains are replaced):

https://gist.github.com/lbtc-xxx/b6f2b94fe90ee187df9c

And relevant part of James log:

https://gist.github.com/lbtc-xxx/ab19bb22c2071086d7c0

Still I'm not sure why it hasn't arrived to k...@example.org as well as 
kyle-c...@example.org. Note that it works as I expected in other cases 
where recipient of mail is only k...@example.org.

How can I turn verbose logging mail recipients before and after mailet on?

Kohei

On 2/11/16 16:51, Bernd Waibel wrote:
> Hello Kohei,
>
> I am not sure how you are "sending" mails, do you do this with a mail client 
> like outlook, or using "telnet?".
>
> I am asking because your sending mail server or mail client may split mails, 
> if they go to different recipients. Also james may do this.
> If you send one mail to "a...@firstdomain.de" and "a...@seconddomain.de", 
> this two domains could be handled by two different mailservers. So the 
> sending server may clone the mail, and send the first to the mailserver 
> handling "firstdomain.de" and the second to "seconddomain.de". So two mails 
> may exist (with nearly same body, but different envelopes).
>
> Both mails will have different mail envelopes:
> The "to" header inside the mail body does list both recipients.
> The "to" header inside the mail envelope does only list one of the two 
> recipients.
>
> If you configured james to handle both mails, and have set up the mx records 
> also, there may arrive two mails.
> It is possible, depending on sending, that one mail will arrive which has to 
> be split. Not sure.
>
> Also consider the following:
> If you forward a mail, a new "mail object" is created. This new mail will 
> completely be handled again by your matchers.
> It will arrive as new mail in james.
>
> Try logging the mail recipients of every handled mail before and after the 
> mailet.
>
>
> Greetings,
> Bernd
>
> -----Ursprüngliche Nachricht-----
> Von: Kohei Nozaki [mailto:k...@bridge9.sakura.ne.jp]
> Gesendet: Donnerstag, 11. Februar 2016 06:47
> An: James Users List <server-user@james.apache.org>
> Betreff: Re: How to forward email, but left a copy in original address?
>
> I've put something like following definition to mailetcontainer.xml,
> where near of commented definition of XMLRecipientRewriteTable exists,
> and it works as I nearly expected:
>
> <mailet match="RecipientIs=k...@example.org" class="Forward">
>    <forwardTo>kyle-c...@example.org</forwardTo>
>    <passThrough>true</passThrough>
> </mailet>
>
> But I have an odd thing in this setup, and a question about it. my
> situation:
>
> Consider the following are my domains and holding addresses:
>
> * example.org: managed by James
>    - k...@example.org
>    - kyle-c...@example.org
> * example.jp: NOT managed by James
>    - k...@example.jp
>
> When I sent an email through James SMTP server, from k...@example.org to
> k...@example.org (same to from), the email has been arrived to both
> k...@example.org and kyle-c...@example.org, as I expected.
>
> But when I sent an email from k...@example.org to two addresses
> k...@example.org and k...@example.jp, the email has been arrived at
> kyle-c...@example.org, but not to k...@example.org.
>
> Anyone know why the email hasn't arrived to k...@example.org if the two
> addresses are specified?
>
> Thanks.
>
> On 2/7/16 16:00, Kohei Nozaki wrote:
>> Hello, I'm using James3 SNAPSHOT.
>>
>> I want to configure James to forward copy of emails to another address
>> (these two addresses live in same James instance), but keep emails being
>> sent in original address as well.
>>
>> For example, I have two following addresses in a James instance,
>>
>> * f...@example.com
>> * b...@example.com
>>
>> When someone send an email to f...@example.com, it should be arrived to
>> both addresses (f...@example.com and b...@example.com).
>>
>> How can I configure James to achieve this?
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
>> For additional commands, e-mail: server-user-h...@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
> For additional commands, e-mail: server-user-h...@james.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
> For additional commands, e-mail: server-user-h...@james.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to