Hi,
in my case, the problem was not generated by the wrong choice of the LDAP 
attribute (uid or mail) because both have the value <user_name>@<domain_name>.
After a long period of searching and debugging I discovered that the smtp works 
as it should if in the “usersrepository.xml”  contains the following parameter 
in LDAP configuration  " <supportsVirtualHosting>true</supportsVirtualHosting>”.

Please notice that it is called “supportsVirtualHosting", instead of 
“enableVirtualHosting”  as it is written in the effective documentation. Now, 
my configuration contains both tags set to true and looks like below.

<usersrepository name="LocalUsers"
            ldapHost="ldap://localhost:389";
            principal="cn=domain_admin,dc=example,dc=com"
            credentials="<some password>"
            userBase="ou=users,ou=james,dc=example,dc=com"
            userIdAttribute="uid"
            userObjectClass="person">
          <enableVirtualHosting>true</enableVirtualHosting>
          <supportsVirtualHosting>true</supportsVirtualHosting>
          <enableForwarding>true</enableForwarding>
</usersrepository>

Probably a developer can clarify why this difference is.

Regards!


> On 18 Apr 2023, at 04:17, Benoit TELLIER <btell...@apache.org> wrote:
> 
> With "virtual hosting" turned on, the attribute should be an email address so 
> "mail".
> 
> We may need to make this more explicit in the documentation, as this might be 
> a common mistake. Contribution welcome.
> 
> Best regards,
> 
> Benoit
> 
> On 18/04/2023 00:27, Mihai Zamfira wrote:
>> Hi,
>> domain was created before
>> and the result it's below
>> 
>> curl -XGET http://<ip>:<port>/domains
>> 
>> [
>>     "example.com",
>>     "localhost",
>>     "127.0.0.1"
>> ]
>> 
>> The problem has something to do with 
>> "<enableVirtualHosting>true</enableVirtualHosting>” tag from 
>> usersrepository.xml file because if i change it to “false” and the  
>> userIdAttribute to an LDAP attribute that contain only the username (without 
>> @example.com) everything works as expected.
>> 
>> thanks.
>> 
>>> On 17 Apr 2023, at 18:35, Tung Tran Van <tungtv...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Did you add donain?
>>> Can you try:
>>> 
>>> curl -XGET http://localhost:8000/ <http://localhost:8000/users>domains
>>> 
>>> 
>>> Vào Th 2, 17 thg 4, 2023 lúc 22:26 Mihai Zamfira
>>> <mihai.zamf...@logika.ro.invalid> đã viết:
>>> 
>>>> Hi,
>>>> I have installed version 3.7.4 of Apache James on OEL8 and it works
>>>> integrated with Cassandra, Elasticsearch, SOGo (as web mail frontend) and
>>>> the users are stored in OpenLDAP.
>>>> LDAP configuration works and i can see users thru WebAdmin and also i'm
>>>> able to connect on IMAP fomr SOGO or others email clients.
>>>> The problem is with the SMTP server that refuses to recognize local users
>>>> reporting "550 5.1.1 Unknown user:"
>>>> 
>>>> The content of the "usersrepository.xml" file looks like below:
>>>> 
>>>> <usersrepository name="LocalUsers"
>>>>            ldapHost="ldap://localhost:389";
>>>>            principal="cn=domain_admin,dc=example,dc=com"
>>>>            credentials=“<some password>"
>>>>            userBase="ou=users,ou=james,dc=example,dc=com"
>>>>            userIdAttribute="uid"
>>>>            userObjectClass="person">
>>>>          <enableVirtualHosting>true</enableVirtualHosting>
>>>>          <enableForwarding>true</enableForwarding>
>>>> </usersrepository>
>>>> 
>>>> Therefore the VirtualHosting it's enable and the user has ending with "@
>>>> example.com"
>>>> 
>>>> resuts from "curl -XGET http://localhost:8000/users"; show me that the
>>>> Apache James can read users from OpenLdap
>>>> 
>>>> [
>>>>    {
>>>>        "username": "test.u...@example.com"
>>>>    }
>>>> ]
>>>> 
>>>> 
>>>> The real problem appears when I try to set the SMTP server with the telnet
>>>> command and the result is shown below
>>>> 
>>>> [root@mail ~]# telnet 127.0.0.1 25
>>>> Trying 127.0.0.1...
>>>> Connected to 127.0.0.1.
>>>> Escape character is '^]'.
>>>> 220 Apache JAMES awesome SMTP Server
>>>> ehlo test
>>>> 250-mail.example.com Hello test [127.0.0.1])
>>>> 250-PIPELINING
>>>> 250-ENHANCEDSTATUSCODES
>>>> 250 8BITMIME
>>>> mail from:<test.u...@example.com>
>>>> 250 2.1.0 Sender <test.u...@example.com> OK
>>>> rcpt to:<test.u...@example.com>
>>>> 550 5.1.1 Unknown user: test.u...@example.com
>>>> Connection closed by foreign host.
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
>>>> For additional commands, e-mail: server-user-h...@james.apache.org
>>>> 
>>>> --
>>> Tung, Tran Van
>>> *Phone:* (+84) 35 757 6258
>> 
>> ---------------------------------------------------------------------
>> 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