no line breaks in plain text emails

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

    no line breaks in plain text emails

    I'm using the mail($MailTo, $Subject, $Body, $headers) function to
    send out plain text emails, with the message/body being entered via a
    form. When the email arrives, the message is displayed as a continuous
    line, without carriage returns or line breaks.
    I have tried inserting a number of different headers but always with
    the same results. Can the problem be fixed with headers?

    This only happens on Outlook/Windows XP - other setups show the email
    fine!

    Thanks...
  • Pedro Graca

    #2
    Re: no line breaks in plain text emails

    chokky wrote:[color=blue]
    > This only happens on Outlook/Windows XP - other setups show the email
    > fine![/color]

    Try this (just fishing):

    <?php
    // ...
    $Body = str_replace("\n ", "\r\n", $Body);
    $headers .= "\r\nConten t-Type: text/plain";
    mail($MailTo, $Subject, $Body, $headers);
    ?>
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Geoff Berrow

      #3
      Re: no line breaks in plain text emails

      I noticed that Message-ID:
      <5a294291.04021 50916.65e1cc86@ posting.google. com> from chokky contained
      the following:
      [color=blue]
      >When the email arrives, the message is displayed as a continuous
      >line, without carriage returns or line breaks.[/color]



      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • chokky

        #4
        Re: no line breaks in plain text emails

        > Try this (just fishing):[color=blue]
        >
        > <?php
        > // ...
        > $Body = str_replace("\n ", "\r\n", $Body);
        > $headers .= "\r\nConten t-Type: text/plain";
        > mail($MailTo, $Subject, $Body, $headers);
        > ?>[/color]

        Thanks. Good suggestion - but this forces an extra break between
        lines. Any other ideas welcome!

        Comment

        • Paul 'piz' Wellner Bou

          #5
          Re: no line breaks in plain text emails

          chokky wrote:[color=blue][color=green]
          >>Try this (just fishing):
          >>
          >> 1 <?php
          >> 2 // ...
          >> 3 $Body = str_replace("\n ", "\r\n", $Body);
          >> 4 $headers .= "\r\nConten t-Type: text/plain";
          >> 5 mail($MailTo, $Subject, $Body, $headers);
          >> 6 ?>[/color]
          > Thanks. Good suggestion - but this forces an extra break between
          > lines. Any other ideas welcome![/color]

          change line 3:
          $Body = preg_replace("\ r?\n", "\r\n", $Body);

          Comment

          • chokky

            #6
            Re: no line breaks in plain text emails

            > change line 3:[color=blue]
            > $Body = preg_replace("\ r?\n", "\r\n", $Body);[/color]

            Tried this too but no joy. Should I give up yet...?!

            Comment

            • Pedro Graca

              #7
              Re: no line breaks in plain text emails

              chokky wrote:[color=blue]
              > Tried this too but no joy. Should I give up yet...?![/color]

              Can you post a complete mail with all the headers? -- well ... we could
              without the Received:, X-*:, and a lot of others :)
              --
              --= my mail box only accepts =--
              --= Content-Type: text/plain =--
              --= Size below 10001 bytes =--

              Comment

              Working...