473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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...
Jul 17 '05 #1
6 4931
chokky wrote:
This only happens on Outlook/Windows XP - other setups show the email
fine!


Try this (just fishing):

<?php
// ...
$Body = str_replace("\n", "\r\n", $Body);
$headers .= "\r\nContent-Type: text/plain";
mail($MailTo, $Subject, $Body, $headers);
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
I noticed that Message-ID:
<5a**************************@posting.google.com > from chokky contained
the following:
When the email arrives, the message is displayed as a continuous
line, without carriage returns or line breaks.


http://uk2.php.net/wordwrap

--
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/
Jul 17 '05 #3
> Try this (just fishing):

<?php
// ...
$Body = str_replace("\n", "\r\n", $Body);
$headers .= "\r\nContent-Type: text/plain";
mail($MailTo, $Subject, $Body, $headers);
?>


Thanks. Good suggestion - but this forces an extra break between
lines. Any other ideas welcome!
Jul 17 '05 #4
chokky wrote:
Try this (just fishing):

1 <?php
2 // ...
3 $Body = str_replace("\n", "\r\n", $Body);
4 $headers .= "\r\nContent-Type: text/plain";
5 mail($MailTo, $Subject, $Body, $headers);
6 ?>

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


change line 3:
$Body = preg_replace("\r?\n", "\r\n", $Body);
Jul 17 '05 #5
> change line 3:
$Body = preg_replace("\r?\n", "\r\n", $Body);


Tried this too but no joy. Should I give up yet...?!
Jul 17 '05 #6
chokky wrote:
Tried this too but no joy. Should I give up yet...?!


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 =--
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bill | last post by:
I am downloading data from a website that displays it in a table $fp = fopen("a website page", 'r'); The following accesses the stream one <td> element at a time $myData = fgets($fp); Then I...
1
by: Simon Wigzell | last post by:
I'm generating HTML formatted emails in my asp program using CDONT. Depending on hoow ling the link is it will sometimes wrap and ruin the link. The is Detail email properties listing : ...
5
by: middletree | last post by:
I have an email form page, and the body of the message is in a textarea. In testing, I noticed that the paragraph breaks weren't showing up in my web-based email that I sent to myself. So I put in...
5
by: David Blickstein | last post by:
I'm finding it difficult to determine when/where XSLT generates line breaks when generating a text file <xsl:output method="text" media-type="text/plain"/> And... I'm getting thoroughly...
4
by: intl04 | last post by:
I have a memo field that is included in some Access reports I created. Is there some way for the memo field to display nicely formatted text, with line breaks between paragraphs? Or is it necessary...
8
by: Juan Puebla | last post by:
Hi, I have an sql database with some text (nvarchar) fields. The problem is that if I get those fields with a datareader (dr.getstring(0)) an then I save text in a txt file I loose all the line...
14
by: ghostwalker | last post by:
Hi I have an HTML form with a textarea on it. When submitted (using 'get' not 'post') this forms action php file simply does this to retrieve the values: $message = $_GET; Now it all works...
8
by: mkalex | last post by:
Hi All, Great site BTW! OK, I'm very new at this so forgive me ignorance, please! I have a little JS that emails elements from a form; name, choice from a drop-down list, and "comments". It all...
0
by: lundmark | last post by:
When I send a plain-text message using Outook 2007, I want hard line breaks to be added to my outgoing message. I cannot seem to make this happen. I have configured Outlook to Automatically wrap...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.