SMTP Error: 500 5.2.3 Line Too Long Issue

I am encountering an issue while sending emails via SMTP using PHPMailer. The error message I receive is:
SERVER → CLIENT: 500 5.2.3 line too long
SMTP ERROR: DATA END command failed: 500 5.2.3 line too long
SMTP Error: data not accepted.

Iam using small html template not exceeding 900 length

https://docs.kumomta.com/reference/kumo/start_esmtp_listener/line_length_hard_limit/

how to solve this.increasing line_length_hard_limit is a proper way ?
is there option to solve this using my php code before pushing to kumomta ?

You can change the length at KumoMTA config

Not recommended

Or you can, well.., fix it at your end like in PHP

put line breaks every 998 characters if required

Setting KumoMTA to accept lines that are longer than the RFC may just move the problem to when KumoMTA tries to deliver the message. You can use check_fix_conformance to fix the line length but this can have a visual impact on rendering that would be unpredictable.

It is always better to fix how you template and generate to make sure things are predictable in the user’s inbox (and to help make sure it reaches the inbox).

I didn’t know that KumoMTA could repair emails <a:Peepo_Mind_Blown_1:1315993588680626186>

It can, and some of the fixes it can do are safe, but when you ask it to fix line length you give up control of where the line breaks are in a message. That may or may not cause issues.

In this case you’d have to increase the line length limit in the listener to let the message in, then run check fix conformance.

Hi , This is not working . Same error

Sharing your full current config, injection message, injection code, and exact error are probably required to solve this problem. My guess is that you have a configuration problem with PHP.

KumoMTA includes a number of helpful diagnostic tools. Sharing the output of a kcli server trace or log trace or any of the myriad of other diagnostic data would be helpful.

I don’t want to take over Vin’s question but I have a similar question, if we are injecting messages via API is it up to the API caller to have the right line length in the HTML blob or does kumo normalize the API submissions

The “check/fix” function can take care of that with Mike’s note above

yeah i just wanted to verify, we’ll have to do some testing on our end to make sure the html doesnt end up clobbered

but i think it gets pretty clobbered anyway inside the mime parts so it should be “ok”

our text parts we limit down pretty small anyway. i still format text like i would for mutt and it’s never done me wrong

kumo.on('smtp_server_message_received', function(msg) local failed = msg:check_fix_conformance( 'MISSING_COLON_VALUE', 'LINE_TOO_LONG' ) if failed then kumo.reject(552, string.format('5.6.0 %s', failed)) end end)

Hi @faithful-ostrich This config is not working properly . “500 5.2.3 line too long” issue not fixed. Is there any other way to fix this
kumo.on('smtp_server_message_received', function(msg) local failed = msg:check_fix_conformance( 'MISSING_COLON_VALUE', 'LINE_TOO_LONG' ) if failed then kumo.reject(552, string.format('5.6.0 %s', failed)) end end)

OK. If it really is a “line too long” error and not something masquerading as that, then the check fix typically will fix it. I’d suggest you have a different problem.
However, Since you have not provided ANY of the requested information (AGAIN) it is very difficult to provide you with any assistance.

If you can provide:

  • The payload and template you are using,
  • full config
  • Full error messages
  • Server and client traces
    Then someone in the community might be able to help. Without that information, it is impossible for anyone to provide any effective help.