70 characters limit when sending mails

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • woof

    70 characters limit when sending mails

    Hello,

    I have built a "contact us" form on my Web site and am using the PHP
    mail() function to send an e-mail to the Webmaster (that's me :-))
    Everything works fine. What I would like to know however is whether it
    is always necessary to limit each line of the message to 70 characters,
    as is written in the documentation of the function (writing for
    instance $this->message = wordwrap($messa ge, 70)).
    It seems to work fine without doing it in my case and the text is
    easier to read.
    I guess there must be a reason for the limit, but how to find out when
    it is needed?

  • Jerry Stuckle

    #2
    Re: 70 characters limit when sending mails

    woof wrote:[color=blue]
    > Hello,
    >
    > I have built a "contact us" form on my Web site and am using the PHP
    > mail() function to send an e-mail to the Webmaster (that's me :-))
    > Everything works fine. What I would like to know however is whether it
    > is always necessary to limit each line of the message to 70 characters,
    > as is written in the documentation of the function (writing for
    > instance $this->message = wordwrap($messa ge, 70)).
    > It seems to work fine without doing it in my case and the text is
    > easier to read.
    > I guess there must be a reason for the limit, but how to find out when
    > it is needed?
    >[/color]

    It's probably because your email program (Outlook, Thunderbird, etc.) is
    set up to wrap text at 70 characters. Mine is, but I can disable it.

    No RFC about it, AFAIK - just the email program's attempt to keep long
    lines from wrapping off the end of the screen.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Toby Inkster

      #3
      Re: 70 characters limit when sending mails

      woof wrote:
      [color=blue]
      > Everything works fine. What I would like to know however is whether it
      > is always necessary to limit each line of the message to 70 characters,
      > as is written in the documentation of the function (writing for
      > instance $this->message = wordwrap($messa ge, 70)).[/color]

      RFC 822 (Standard for the Format of ARPA Internet Text Messages) and its
      successor RFC 2822 (Internet Message Format) say:

      | There are two limits that this standard places on the number of
      | characters in a line. Each line of characters MUST be no more than
      | 998 characters, and SHOULD be no more than 78 characters, excluding
      | the CRLF.

      In practice, it is *sometimes* safe to ignore this.

      However, tf you want to allow long lines, there are smarter ways of doing
      this rather than just ignoring the RFCs. For example, you could try using
      one of the MIME encoding options provided by PHP.

      e.g.

      $msgenc = base64encode($m essage);
      $hdrs = "Content-Type: text/plain\r\n"
      . "Content-Transfer-Encoding: base64\r\n";
      mail($to, $subject, $msgenc, $hdrs);

      --
      Toby A Inkster BSc (Hons) ARCS
      Contact Me ~ http://tobyinkster.co.uk/contact

      Comment

      • woof

        #4
        Re: 70 characters limit when sending mails

        Thank you Toby.
        I understand that encoding the message would enable me to send the
        message without having to worry about the recommended 70-characters per
        line limit, right?
        However, if I write
        $msgenc = base64encode($m essage);
        the email received is encoded (in other terms not decoded by Outlook
        Express on my PC).
        Is adding
        Content-Transfer-Encoding: base64
        sufficient?

        Comment

        • Toby Inkster

          #5
          Re: 70 characters limit when sending mails

          woof wrote:
          [color=blue]
          > I understand that encoding the message would enable me to send the
          > message without having to worry about the recommended 70-characters per
          > line limit, right?[/color]

          Yep.
          [color=blue]
          > However, if I write
          > $msgenc = base64encode($m essage);
          > the email received is encoded (in other terms not decoded by Outlook
          > Express on my PC).
          > Is adding
          > Content-Transfer-Encoding: base64
          > sufficient?[/color]

          You'll also want "Content-Type:text/plain" and "MIME-Version:1.0" headers.

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact

          Comment

          • woof

            #6
            Re: 70 characters limit when sending mails

            That's pretty clear. Thanks again.

            Comment

            Working...