Hi everyone,

I am new with James and I am reading as much documentation (and even some
source code) that I can. I was wondering if there was a complete behavior
documentation about the RecipientRewriteTable. What I mean is that part of
the documentation seems buggy and some parts of the implementation seems
not enough flexible, while still being flexible in other ways.

Bassically, here are my use cases. I want:
1 - To have local accounts (no issue there)
2 - To be able to set redirections from one email to multiple emails
3 - To be able to sometime have a catchall email address


---[ 2 - To be able to set redirections from one email to multiple emails
]---

Starting with the documentation available here
https://james.apache.org/server/manage-cli.html

  You can manage address mapping like (redirects email from [email protected]
to [email protected], then deletes the mapping):

  {cli} AddAddressMapping redirected domain.new [email protected]


That means that to redirect [email protected] -> [email protected], we
need to execute:
{cli} AddAddressMapping redirected domain.new [email protected]

Which looks like the reverse to <- from and that looks fine when we look at
the next one about Regex, which is
{cli} AddRegexMapping redirected domain.new .*@domain.tld


Trying from [email protected] to [email protected] (a local account)
../bin/james-cli.sh -h 127.0.0.1 -p 9999 AddAddressMapping admin
foilen-lab.com [email protected]

../bin/james-cli.sh -h 127.0.0.1 -p 9999 ListMappings
[email protected][email protected]

That looks backward. Looking at the DB:
  INSERT INTO `JAMES_RECIPIENT_REWRITE` (`DOMAIN_NAME`, `USER_NAME`,
`TARGET_ADDRESS`) VALUES ('foilen-lab.com','admin','[email protected]');

It would mean that the target is the alias for the redirection and it goes
to USER_NAME+DOMAIN_NAME, which could be fine, but since the primary key is:
  PRIMARY KEY (`DOMAIN_NAME`,`USER_NAME`)
That implies that a destination can be used only once. E.g: I cannot have
[email protected] and [email protected] both going to
[email protected] , which makes no sense.

Then, looking at the logs when sending an email to [email protected]:
  Rejected message. Unknown user: [email protected]

Looks like the redirection is being ignored.


       ---------------------

Now, trying it the other way around:
  ../bin/james-cli.sh -h 127.0.0.1 -p 9999 RemoveAddressMapping admin
foilen-lab.com [email protected]
  ../bin/james-cli.sh -h 127.0.0.1 -p 9999 AddAddressMapping redir1
foilen-lab.com [email protected]

Sending an email to [email protected] now goes to my
[email protected] local account.

[FIX 1] So, the documentation needs to be fixed.

Then, due to the primary key, that means that I cannot put one source to
multiple targets. Is that a "per design" limitation or a "bug"? I could
understand it as a "per design" limitation, but considering it is possible
to have:
- [email protected] -> [email protected]
- redir.*@foilen-lab.com -> [email protected]
Due to the regexp, both matches, so what is the expected behavior? (is it
sending to both, to one randomly or to one with a special logic?)


---[ 3- To be able to sometime have a catchall email address ]---

In the interface RecipientRewriteTable, I see there is a WILDCARD = "*"
which could make me happy. I haven't tested it yet and I am wondering the
behavior.

My expected behavior would be, for a specific email address:
- If there is a rewrite, do it
- Else if there is a local account, use it
- Else if there is a wildcard for the domain, use it
- Else, don't care since it will eventually go to "local-address-error"

Is that the actual behavior? Due to the "regexp" feature which could have
some rewrites like:
- .*@foilen-lab.com -> [email protected]
that would be a catchall while also permit being matched by other regexp, I
really don't know where that is going.


thanks

Reply via email to