You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Bernd Fondermann <bf...@brainlounge.de> on 2011/04/18 23:30:40 UTC
Mail Alias
Hi,
How can I make James from Trunk to send all mails for a@mydomain.nn to
b@mydomain.nn - I can't find the appropriate admin command in JMX.
Thanks,
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
> verified. it works. don't know what was going wrong.
See my previous mail (just a supposition...).
> Thanks you!
You're welcome :)
- Eric
>
> Bernd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Bernd Fondermann <be...@googlemail.com>.
On Tue, Apr 19, 2011 at 09:33, Bernd Fondermann
<be...@googlemail.com> wrote:
> On Tue, Apr 19, 2011 at 09:07, Eric Charles <er...@apache.org> wrote:
>> So, call addAddressMapping(a, mydomain.nn, b@mydomain.nn).
>>
>> b@mydomain.nn must be created as a valid james user.
>
> ok, that's what I thought.
> This setting didn't work with my fairly recent build, so I thought
> there maybe some gotcha.
>
> 1. I will try again in a dev env.
verified. it works. don't know what was going wrong.
Thanks you!
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
RRT is a whole topic as such.
I just created https://issues.apache.org/jira/browse/JAMES-1227 to
follow it.
Tks,
- Eric
On 19/04/2011 11:12, Bernd Fondermann wrote:
> On Tue, Apr 19, 2011 at 11:05, Stefano Bagnara<ap...@bago.org> wrote:
>>> Stefano mentioned the need to rewrite to a non existing user (to be further
>>> processed by other mailets).
>>
>> Or to redirect the message to an external user.
>>
>>> So if we throw exception, we may prohibit that functionality...
>>>
>>> But if we remain with the current implementation, I'm pretty sure I was not
>>> the first and you won't be the last to have "strange" behaviors.
>>>
>>> We could duplicate all methods: 1 mapping to existing account, the other
>>> mapping to non-existing account, but I'm not happy with that solution.
>>>
>>> Any thoughts.
>>
>> IMO it is all about "a message to address a@domaina is instead
>> delivered to b@domainb": why should we make special cases? a can be
>> local or remote, b can be local or remote. There are 4 combinations
>> but IMHO they don't need special treatment.
>>
>> I may want to rewrite a@domaina to a@domaina, b@domainb (so if a is
>> local I deliver a copy of each message to the local user a and a copy
>> to a remote b user).
>>
>> That said, I don't know how this stuff is exposed in current trunk so
>> maybe this doesn't make sense, but this is how 99% of mail servers out
>> there works.
>>
>> IMHO there is no point in checking for local user existence: this will
>> make things much more complex. E.g: you will have to check consistency
>> when a user is removed so to remove each alias pointing to it.
>>
>> Here is what Bernd described:
>> --------------
>> That's what I remember doing:
>> 1. no accounts.
>> 2. create account a@mydomain.nn
>> 3. create mapping b@mydomain.nn => a@mydomain.nn
>> 4. try to send mail to b, bounces
>> ---------------
>>
>> I would have been surprised to get an error in #3, and #4 is really
>> unexpected. Why didn't 1..3 work? This is exactly what I would have
>> done to create an alias.
>>
>> Are the mapping rules applied until the first match or instead are all
>> applied to the last rule?
>> Are the mapping rules applied recursively until you find matches or
>> instead only once?
>>
>> e.g, I add this mappings / rewrites:
>> a => b
>> b => c
>> b => a
>> d => f
>> e => d
>> f => g
>>
>> Who receives messages destinated to a? b, c+a or does it loops?
>> Who receives messages to d? f or g?
>> Who receives messages to e? d or g?
>>
>> These are the questions I make when I see e rewrite engine, I would
>> never expect the answers to the above questions to be: "if X is local
>> then Y, otherwise if it is remote Z, if instead it is local but non
>> existing then K"
>
> I retreat my previous +1 for throwing an exception. It would cut off
> a lot of useful use cases.
>
> However, what would be cool would be a JMX operation like
> testMapping(), taking a recipient as an argument and printing the
> currently mapped receiver and gives a hint if the receiver is an
> existing local account or not.
>
> Bernd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Bernd Fondermann <be...@googlemail.com>.
On Tue, Apr 19, 2011 at 11:05, Stefano Bagnara <ap...@bago.org> wrote:
>> Stefano mentioned the need to rewrite to a non existing user (to be further
>> processed by other mailets).
>
> Or to redirect the message to an external user.
>
>> So if we throw exception, we may prohibit that functionality...
>>
>> But if we remain with the current implementation, I'm pretty sure I was not
>> the first and you won't be the last to have "strange" behaviors.
>>
>> We could duplicate all methods: 1 mapping to existing account, the other
>> mapping to non-existing account, but I'm not happy with that solution.
>>
>> Any thoughts.
>
> IMO it is all about "a message to address a@domaina is instead
> delivered to b@domainb": why should we make special cases? a can be
> local or remote, b can be local or remote. There are 4 combinations
> but IMHO they don't need special treatment.
>
> I may want to rewrite a@domaina to a@domaina, b@domainb (so if a is
> local I deliver a copy of each message to the local user a and a copy
> to a remote b user).
>
> That said, I don't know how this stuff is exposed in current trunk so
> maybe this doesn't make sense, but this is how 99% of mail servers out
> there works.
>
> IMHO there is no point in checking for local user existence: this will
> make things much more complex. E.g: you will have to check consistency
> when a user is removed so to remove each alias pointing to it.
>
> Here is what Bernd described:
> --------------
> That's what I remember doing:
> 1. no accounts.
> 2. create account a@mydomain.nn
> 3. create mapping b@mydomain.nn => a@mydomain.nn
> 4. try to send mail to b, bounces
> ---------------
>
> I would have been surprised to get an error in #3, and #4 is really
> unexpected. Why didn't 1..3 work? This is exactly what I would have
> done to create an alias.
>
> Are the mapping rules applied until the first match or instead are all
> applied to the last rule?
> Are the mapping rules applied recursively until you find matches or
> instead only once?
>
> e.g, I add this mappings / rewrites:
> a => b
> b => c
> b => a
> d => f
> e => d
> f => g
>
> Who receives messages destinated to a? b, c+a or does it loops?
> Who receives messages to d? f or g?
> Who receives messages to e? d or g?
>
> These are the questions I make when I see e rewrite engine, I would
> never expect the answers to the above questions to be: "if X is local
> then Y, otherwise if it is remote Z, if instead it is local but non
> existing then K"
I retreat my previous +1 for throwing an exception. It would cut off
a lot of useful use cases.
However, what would be cool would be a JMX operation like
testMapping(), taking a recipient as an argument and printing the
currently mapped receiver and gives a hint if the receiver is an
existing local account or not.
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Stefano Bagnara <ap...@bago.org>.
> Stefano mentioned the need to rewrite to a non existing user (to be further
> processed by other mailets).
Or to redirect the message to an external user.
> So if we throw exception, we may prohibit that functionality...
>
> But if we remain with the current implementation, I'm pretty sure I was not
> the first and you won't be the last to have "strange" behaviors.
>
> We could duplicate all methods: 1 mapping to existing account, the other
> mapping to non-existing account, but I'm not happy with that solution.
>
> Any thoughts.
IMO it is all about "a message to address a@domaina is instead
delivered to b@domainb": why should we make special cases? a can be
local or remote, b can be local or remote. There are 4 combinations
but IMHO they don't need special treatment.
I may want to rewrite a@domaina to a@domaina, b@domainb (so if a is
local I deliver a copy of each message to the local user a and a copy
to a remote b user).
That said, I don't know how this stuff is exposed in current trunk so
maybe this doesn't make sense, but this is how 99% of mail servers out
there works.
IMHO there is no point in checking for local user existence: this will
make things much more complex. E.g: you will have to check consistency
when a user is removed so to remove each alias pointing to it.
Here is what Bernd described:
--------------
That's what I remember doing:
1. no accounts.
2. create account a@mydomain.nn
3. create mapping b@mydomain.nn => a@mydomain.nn
4. try to send mail to b, bounces
---------------
I would have been surprised to get an error in #3, and #4 is really
unexpected. Why didn't 1..3 work? This is exactly what I would have
done to create an alias.
Are the mapping rules applied until the first match or instead are all
applied to the last rule?
Are the mapping rules applied recursively until you find matches or
instead only once?
e.g, I add this mappings / rewrites:
a => b
b => c
b => a
d => f
e => d
f => g
Who receives messages destinated to a? b, c+a or does it loops?
Who receives messages to d? f or g?
Who receives messages to e? d or g?
These are the questions I make when I see e rewrite engine, I would
never expect the answers to the above questions to be: "if X is local
then Y, otherwise if it is remote Z, if instead it is local but non
existing then K"
Stefano
>> BTW, I like the new recipient mapping a lot. When handled right, it's
>> immensely powerful.
>>
>
> The point is to handle it right, yes :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
> That's what I remember doing:
> 1. no accounts.
> 2. create account a@mydomain.nn
> 3. create mapping b@mydomain.nn => a@mydomain.nn
> 4. try to send mail to b, bounces
> 5. create account b@mydomain.nn
> 6. send mail to b, does not get delivered to a, doesn't bounce (didn't
> verify, but probably delivered to b)
>
> It's possible that I did something different and wrong along the way.
> If not, is it neccessary to create both accounts before creating the
> mapping?
I also had such "strange" behavior.
This won't be the case anymore if we throw exception when mapping to non
existing user.
>
>> Maybe we should open a JIRA to throw exception if you try to map to a
>> non-existing account. Is this the wanted behavior?
>
> +1
Stefano mentioned the need to rewrite to a non existing user (to be
further processed by other mailets).
So if we throw exception, we may prohibit that functionality...
But if we remain with the current implementation, I'm pretty sure I was
not the first and you won't be the last to have "strange" behaviors.
We could duplicate all methods: 1 mapping to existing account, the other
mapping to non-existing account, but I'm not happy with that solution.
Any thoughts.
Eric
>
> BTW, I like the new recipient mapping a lot. When handled right, it's
> immensely powerful.
>
The point is to handle it right, yes :)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Bernd Fondermann <be...@googlemail.com>.
On Tue, Apr 19, 2011 at 10:08, Eric Charles <er...@apache.org> wrote:
> On 19/04/2011 09:33, Bernd Fondermann wrote:
>>
>> On Tue, Apr 19, 2011 at 09:07, Eric Charles<er...@apache.org> wrote:
>>>
>>> So, call addAddressMapping(a, mydomain.nn, b@mydomain.nn).
>>>
>>> b@mydomain.nn must be created as a valid james user.
>>
>> ok, that's what I thought.
>> This setting didn't work with my fairly recent build, so I thought
>> there maybe some gotcha.
>>
>> 1. I will try again in a dev env.
>>
>
> my 2-cent is that gotcha is the following: you did some test and defined a
> mapping from the real account to a non-existing account.
> This mapping takes precedence, and when you send a mail to your real
> account, it goes to a non-existing account (to the invalid recipient mail
> repo).
> I talked about this some time ago, but we derived to the vut rename in rrt.
That's what I remember doing:
1. no accounts.
2. create account a@mydomain.nn
3. create mapping b@mydomain.nn => a@mydomain.nn
4. try to send mail to b, bounces
5. create account b@mydomain.nn
6. send mail to b, does not get delivered to a, doesn't bounce (didn't
verify, but probably delivered to b)
It's possible that I did something different and wrong along the way.
If not, is it neccessary to create both accounts before creating the
mapping?
> Maybe we should open a JIRA to throw exception if you try to map to a
> non-existing account. Is this the wanted behavior?
+1
>
>
>> Now:
>> 2. What's the deal with unsetAlias and unsetForwardAddress in
>> component usersrepository?
>> The setXXX operations seem to be missing.
>>
>
> These are some rest-over from the "alias" and "forward" stuff.
> Now, everything must happen via rrt mappings.
> I didn't check code atm, but if it's safe to remove them, we should do it.
ok, great.
BTW, I like the new recipient mapping a lot. When handled right, it's
immensely powerful.
Bernd
>
>> Bernd
>>
>>> btw, in my snapshot, rewriten mails have a To header = "To:
>>> undisclosed-recipients:;"
>>
>> Good to know.
>
> Is this a bug or a feature ?
>
>>
>> Bernd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
On 19/04/2011 09:33, Bernd Fondermann wrote:
> On Tue, Apr 19, 2011 at 09:07, Eric Charles<er...@apache.org> wrote:
>> So, call addAddressMapping(a, mydomain.nn, b@mydomain.nn).
>>
>> b@mydomain.nn must be created as a valid james user.
>
> ok, that's what I thought.
> This setting didn't work with my fairly recent build, so I thought
> there maybe some gotcha.
>
> 1. I will try again in a dev env.
>
my 2-cent is that gotcha is the following: you did some test and defined
a mapping from the real account to a non-existing account.
This mapping takes precedence, and when you send a mail to your real
account, it goes to a non-existing account (to the invalid recipient
mail repo).
I talked about this some time ago, but we derived to the vut rename in rrt.
Maybe we should open a JIRA to throw exception if you try to map to a
non-existing account. Is this the wanted behavior?
> Now:
> 2. What's the deal with unsetAlias and unsetForwardAddress in
> component usersrepository?
> The setXXX operations seem to be missing.
>
These are some rest-over from the "alias" and "forward" stuff.
Now, everything must happen via rrt mappings.
I didn't check code atm, but if it's safe to remove them, we should do it.
> Bernd
>
>> btw, in my snapshot, rewriten mails have a To header = "To:
>> undisclosed-recipients:;"
>
> Good to know.
Is this a bug or a feature ?
>
> Bernd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Bernd Fondermann <be...@googlemail.com>.
On Tue, Apr 19, 2011 at 09:07, Eric Charles <er...@apache.org> wrote:
> So, call addAddressMapping(a, mydomain.nn, b@mydomain.nn).
>
> b@mydomain.nn must be created as a valid james user.
ok, that's what I thought.
This setting didn't work with my fairly recent build, so I thought
there maybe some gotcha.
1. I will try again in a dev env.
Now:
2. What's the deal with unsetAlias and unsetForwardAddress in
component usersrepository?
The setXXX operations seem to be missing.
Bernd
> btw, in my snapshot, rewriten mails have a To header = "To:
> undisclosed-recipients:;"
Good to know.
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
So, call addAddressMapping(a, mydomain.nn, b@mydomain.nn).
b@mydomain.nn must be created as a valid james user.
btw, in my snapshot, rewriten mails have a To header = "To:
undisclosed-recipients:;"
Tks,
- Eric
On 19/04/2011 06:05, Eric Charles wrote:
> Hi Bernd,
>
> I've written this in the doc for upcoming website:
>
> "rewrite a 'fromAny(Existing/NotExisting)' to a 'toExisting'".
>
> Example: addAddressMapping(String user, String domain, String address)
>
> -> you have a user+domain (can be plain, wildcard or *)
> --> rewritten to address (= existing email account: with or without
> domain part, depending on virtualHosting enabled - default is true).
>
> Maybe we should change the method signature to
> addAddressMapping(String fromUser, String fromDomain, String toAccount)
>
> Wdyt?
>
> Tks,
> - Eric
>
>
> On 18/04/2011 23:30, Bernd Fondermann wrote:
>> Hi,
>>
>> How can I make James from Trunk to send all mails for a@mydomain.nn to
>> b@mydomain.nn - I can't find the appropriate admin command in JMX.
>>
>> Thanks,
>>
>> Bernd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: Mail Alias
Posted by Eric Charles <er...@apache.org>.
Hi Bernd,
I've written this in the doc for upcoming website:
"rewrite a 'fromAny(Existing/NotExisting)' to a 'toExisting'".
Example: addAddressMapping(String user, String domain, String address)
-> you have a user+domain (can be plain, wildcard or *)
--> rewritten to address (= existing email account: with or without
domain part, depending on virtualHosting enabled - default is true).
Maybe we should change the method signature to
addAddressMapping(String fromUser, String fromDomain, String toAccount)
Wdyt?
Tks,
- Eric
On 18/04/2011 23:30, Bernd Fondermann wrote:
> Hi,
>
> How can I make James from Trunk to send all mails for a@mydomain.nn to
> b@mydomain.nn - I can't find the appropriate admin command in JMX.
>
> Thanks,
>
> Bernd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org