Error when sending E-Mail to certain providers because of SMTP protocol violation

Hey there,

since my update to 20.3 mails send by dolibarr bounce when sending invoices via E-Mail to certain customers.

The error I get on the failed delivery report mail is:
SMTP error from remote server for TEXT command, host: smtpin.rzone.de (81.169.145.97) reason: 554 5.6.0 SMTP protocol violation: A header line must be terminated by CRLF

It seems like certain Mail-Service-Providers (here Strato) are blocking the E-Mails, while others (Telekom, Proton, Web.de) are accepting the messages. I suspect that Dolibarr is encoding the Mail-Header in an non RFC-Compliant way, since Stratro recently started enforcing RFCs more strictly.

Did anyone of you also have a similar problem and / or has a solution?

Many thanks!

Greetings,
sn0b4ll

Edit: Typos

oh, where do you see the error report? does it bounce back to you, or is it in the mailserver log?

Hey :wave:

it bounces back to my mail account. The sending itself looks fine, seeing no errors in the logs of dolibarr.

does it state which header is the issue?

My expectation is that it is a PHP library that actually sends the email, which PHP version are you running?

Could it be something that your SMTP server adds before sending it on?

Hey :wave:

sadly no, just that overall error and afterwards the mail itself.

I noticed that the subject and nail addresses are encoded in utf-8, while they should be ASCII according to the RFC? But that’s a wild guess from my side.

I can give you feedback on the version in the upcoming days, but I am using the docker version. I will check when I am at the location again.

The SMTP server is not the problem, I am able to send mails via Thunderbird and the same credentials to addresses that bounce when addressed via dolibarr :confused:

If you use the docker image, there is no reason to supply the PHP version, that can be inferred from the docker image.

Okay, that does not seem to be a SMTP server issue - through probably IP address and/or username is different for your Thunderbird and your Dolibarr.

I think you should report the issue on github as a bug, and include as much information as possible.

I had a similar issue after dolibarr update from 19.0.2 to 20.0.3 with following Error using Strato Server
"error during sending E-Mail (Sender=my companymy@domain.com, Receiver=me@domain.com)
Error [120]: Ran into problems sending Mail. Response: 554 5.6.0 SMTP protocol violation: A header line must be terminated by CRLF "

i changed from SMTP/SMTPS socket library (works on 19.0.2) to Swift Mailer socket library (works on 20.0.3)
all other settings remain the same.

brgds
Joey