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 Bernd Waibel <BW...@intarsys.de> on 2016/02/11 08:51:34 UTC

AW: How to forward email, but left a copy in original address? [unsigned]

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:kyle@bridge9.sakura.ne.jp] 
Gesendet: Donnerstag, 11. Februar 2016 06:47
An: James Users List <se...@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=kyle@example.org" class="Forward">
  <forwardTo>kyle-copy@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
  - kyle@example.org
  - kyle-copy@example.org
* example.jp: NOT managed by James
  - kyle@example.jp

When I sent an email through James SMTP server, from kyle@example.org to
kyle@example.org (same to from), the email has been arrived to both
kyle@example.org and kyle-copy@example.org, as I expected.

But when I sent an email from kyle@example.org to two addresses
kyle@example.org and kyle@example.jp, the email has been arrived at
kyle-copy@example.org, but not to kyle@example.org.

Anyone know why the email hasn't arrived to kyle@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,
> 
> * foo@example.com
> * bar@example.com
> 
> When someone send an email to foo@example.com, it should be arrived to
> both addresses (foo@example.com and bar@example.com).
> 
> How can I configure James to achieve this?
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
> 

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


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


Re: AW: AW: How to forward email, but left a copy in original address? [unsigned]

Posted by Kohei Nozaki <ky...@bridge9.sakura.ne.jp>.
Hi Bernd,

Yes, it looks like pass-through is not working as expected.

I'd file this as a bug after check if it will happen at latest James 
build as well, because My James instance is old (I acquired it in 
February 2015).

Thanks again for the advice,

Kohei

On 2/11/16 21:46, Bernd Waibel wrote:
> 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=kyle@example.org, kyle.example.jp" class="Forward">
>     <forwardTo>kyle-copy@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:kyle@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 kyle@example.org as well as
> kyle-copy@example.org. Note that it works as I expected in other cases
> where recipient of mail is only kyle@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:kyle@bridge9.sakura.ne.jp]
>> Gesendet: Donnerstag, 11. Februar 2016 06:47
>> An: James Users List <se...@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=kyle@example.org" class="Forward">
>>     <forwardTo>kyle-copy@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
>>     - kyle@example.org
>>     - kyle-copy@example.org
>> * example.jp: NOT managed by James
>>     - kyle@example.jp
>>
>> When I sent an email through James SMTP server, from kyle@example.org to
>> kyle@example.org (same to from), the email has been arrived to both
>> kyle@example.org and kyle-copy@example.org, as I expected.
>>
>> But when I sent an email from kyle@example.org to two addresses
>> kyle@example.org and kyle@example.jp, the email has been arrived at
>> kyle-copy@example.org, but not to kyle@example.org.
>>
>> Anyone know why the email hasn't arrived to kyle@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,
>>>
>>> * foo@example.com
>>> * bar@example.com
>>>
>>> When someone send an email to foo@example.com, it should be arrived to
>>> both addresses (foo@example.com and bar@example.com).
>>>
>>> How can I configure James to achieve this?
>>>
>>> Thanks.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

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


AW: AW: How to forward email, but left a copy in original address? [unsigned]

Posted by Bernd Waibel <BW...@intarsys.de>.
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=kyle@example.org, kyle.example.jp" class="Forward">
   <forwardTo>kyle-copy@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:kyle@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 kyle@example.org as well as 
kyle-copy@example.org. Note that it works as I expected in other cases 
where recipient of mail is only kyle@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:kyle@bridge9.sakura.ne.jp]
> Gesendet: Donnerstag, 11. Februar 2016 06:47
> An: James Users List <se...@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=kyle@example.org" class="Forward">
>    <forwardTo>kyle-copy@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
>    - kyle@example.org
>    - kyle-copy@example.org
> * example.jp: NOT managed by James
>    - kyle@example.jp
>
> When I sent an email through James SMTP server, from kyle@example.org to
> kyle@example.org (same to from), the email has been arrived to both
> kyle@example.org and kyle-copy@example.org, as I expected.
>
> But when I sent an email from kyle@example.org to two addresses
> kyle@example.org and kyle@example.jp, the email has been arrived at
> kyle-copy@example.org, but not to kyle@example.org.
>
> Anyone know why the email hasn't arrived to kyle@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,
>>
>> * foo@example.com
>> * bar@example.com
>>
>> When someone send an email to foo@example.com, it should be arrived to
>> both addresses (foo@example.com and bar@example.com).
>>
>> How can I configure James to achieve this?
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

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


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


Re: AW: How to forward email, but left a copy in original address? [unsigned]

Posted by Kohei Nozaki <ky...@bridge9.sakura.ne.jp>.
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 kyle@example.org as well as 
kyle-copy@example.org. Note that it works as I expected in other cases 
where recipient of mail is only kyle@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:kyle@bridge9.sakura.ne.jp]
> Gesendet: Donnerstag, 11. Februar 2016 06:47
> An: James Users List <se...@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=kyle@example.org" class="Forward">
>    <forwardTo>kyle-copy@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
>    - kyle@example.org
>    - kyle-copy@example.org
> * example.jp: NOT managed by James
>    - kyle@example.jp
>
> When I sent an email through James SMTP server, from kyle@example.org to
> kyle@example.org (same to from), the email has been arrived to both
> kyle@example.org and kyle-copy@example.org, as I expected.
>
> But when I sent an email from kyle@example.org to two addresses
> kyle@example.org and kyle@example.jp, the email has been arrived at
> kyle-copy@example.org, but not to kyle@example.org.
>
> Anyone know why the email hasn't arrived to kyle@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,
>>
>> * foo@example.com
>> * bar@example.com
>>
>> When someone send an email to foo@example.com, it should be arrived to
>> both addresses (foo@example.com and bar@example.com).
>>
>> How can I configure James to achieve this?
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>

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