Kitura / Swift-SMTP

Swift SMTP client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mail declined by recipient: Syntax error - line too long

LinusGeffarth opened this issue · comments

commented

I cannot send emails to some email addresses. They are rejected with the following message:

Syntax error - line too long

and some more info from here:

Action: failed
Status: 5.0.0
Remote-MTA: DNS; mx-ha02.web.de [212.227.17.8]
Diagnostic-Code: SMTP; 501 Syntax error - line too long
Last-Attempt-Date:
Final-Log-ID: i04d66w419XirMM

Any idea what I need to do?

I receive the same type of issue when sending an HTML attachment. The mail arrives, but it is truncated and has the following in the header:

Sun-Java-System-SMTP-Warning: Lines longer than SMTP allows found and truncated.

@LinusGeffarth Could you provide an example of mail and address that is declined?
Could it be declined by the receiving server (as the error message suggested)?

commented

It is declined by the receiving server, yes. That's why I can still send to some email addresses, while I cannot send to others.
Unfortunately, it's been a while since this issue occurred so I'm not sure I'll find that email...what exactly do you need? The Leaf view? Or the raw email?

I was looking for a way to reproduce it.
I've also found that the maximum length for a line should be 998 (1000+CR LF).
This StackOverflow thread shows the same issue and the solution.
You could add that to your content.
If you come up with a good/generic solution, feel free to submit a PR!

commented

Yeah that 998 chars per line was probably the issue. However, I was not able to reduce line lengths, because just making shorter HTML in the Leaf views didn't help.

Could it be the CR LF that was not using the right encoding? In that case, we will need to have a way to reproduce it in order to fix it...

commented

I'll see if I can grab a copy of the email I tried to send. In which form do you need it? The email itself, or the Leaf view, or something else?

The raw text should do it.