tuxgasy / docker-dolibarr

Use the official repo https://github.com/Dolibarr/dolibarr-docker
GNU General Public License v3.0
130 stars 91 forks source link

Sending Mails with strato fails #133

Closed SmartLiving-Rocks closed 1 year ago

SmartLiving-Rocks commented 1 year ago

Hello everyone, I am running into the following error:

Error [120]: Ran into problems sending Mail. Response: 535 5.7.8 Authentication failed: wrong user/password Error [130]: Invalid Authentication Credentials.

I have tried to send mail with the exact same credentials from a Dolibarr Test Instance that is installed directly on a Windows machine - that is also working fine! I am also running Nextcloud in Docker and tested the credentials (copy/paste bitwarden) and can send mails without any issues.

Bildschirmfoto 2023-10-02 um 11 32 21

Bildschirmfoto 2023-10-02 um 11 33 45

I am using Docker on an Ubuntu 23.04 Server. I am running Dolibarr 18.0.1 where noting has been installed yet - just for testing the email functionality.

Can anyone point me into the right direction, please?

Thanks in advance and have a nice day

dj3mu commented 1 year ago

I ran into a similar problem with mailing using a self-hosted mail server. From mail server logs it was very clear that Dolibarr actually sends a wrong or no password.

I was able to fix it by adding the DOLI_INSTANCE_UNIQUE_ID to my docker-compose.yml (it wasn't present before).
Afterwards I re-configured the password one more time and it started working.

I didn't have time to investigate in more detail. But I suspect that https://github.com/tuxgasy/docker-dolibarr/commit/1c5aec0f98d80ae8dafaba94884140489ca50b7e could be a good candidate for introducing this. My theory is, that now the Unique-ID, if not set in environment, gets re-created on every instance restart. In consequence Dolibarr looses the capability to decrypt the mail password (which is stored incrypted in DB).

SmartLiving-Rocks commented 1 year ago

@dj3mu Thanks for your quick reply! It is working now 🥇 As suggested, I have added a DOLI_INSTANCE_UNIQUE_ID: 'smartliving' and a mail was sent! Very nice. In the meantime I was playing around with an installation directly as explained here: https://wiki.dolibarr.org/index.php?title=Dolibarr_for_Ubuntu_or_Debian Mails worked at the first try and I have noticed that there is also an Option for Test Sending html Do you also know why that is? Bildschirmfoto 2023-10-02 um 15 17 36 Bildschirmfoto 2023-10-02 um 15 15 37

dj3mu commented 1 year ago

[...] Mails worked at the first try and I have noticed that there is also an Option for Test Sending html Do you also know why that is?

Some mail systems might reject mails with HTML content while accepting plain ASCII mails. It think this functionality is for identifying such systems.
So I guess the regular TEST SENDING sends a plain ASCII mail while TEST SENDING HTML sends a Mail using HTML markup for the body.

Btw: You should change your instance DOLI_INSTANCE_UNIQUE_ID one more time if your comment really includes the ID that you had used. In that case you've just disclosed your ID to public but you should keep it secret.