Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am dispatching a few mails (mainly order confirmations) from a webshop using a php mail class. The mails are sent via a local Exchange/SMTP server.

In the majority of cases this works fine and customers receive HTML mails with PDF attachments. But in some cases customers complain about not receiving any mails at all.

MS Exchange informs about mails rejected by several servers - all with the same error message:

500 Line limit exceeded

Does the problem derive from my mails / mail class or is it a server setting? What can I do to avoid it?

share|improve this question
up vote 1 down vote accepted

RFC 821 states the maximum line lengths for SMTP transmissions:

        command line

           The maximum total length of a command line including the
           command word and the <CRLF> is 512 characters.

        reply line

           The maximum total length of a reply line including the
           reply code and the <CRLF> is 512 characters.

        text line

           The maximum total length of a text line including the
           <CRLF> is 1000 characters (but not counting the leading
           dot duplicated for transparency).

I think your messages exceed one of the aforementioned limits - Exchange seems not to bother, but other servers will.

share|improve this answer
sigh typical microsoft :D – BenGC Jul 13 '11 at 13:34
I suppose it exceeds the text line limit. We did a little further investigation and I am wondering that it bothers just one single mailserver provider and its configuration... Do I have to split my text body on Script-side in case of character amounts per line > 500 by \n (line-breaks), which would evoke problems concerning tags in HTML mails or is it a provider's problem which has to be solved? – proximus Jul 14 '11 at 8:44
As the limit is defined in the RFC, it is not the provider's problem. Yes, you should split your overlong lines. It should not create any problems with tags as long as you are not splitting within the tag itself (like <a \n href=...>) – the-wabbit Jul 16 '11 at 6:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.