473,505 Members | 14,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending Plain Text Email

Hi All - I have created a survey and I would like the results of the
survey to be emailed the boss in *plain text*.

Can someone PLEASE take a look and tell me why carriage returns are
not being inserted after each $body ? The email comes out as one big
line.

THANK YOU! Sylvie.

include('Mail.php');
include('Mail/mime.php');
$body .= "Are you aware that SCC has a TDC?\n";
$body .= "$_POST[one]\n";
$body .= "Do you know that our resources are available to clients
outside of SCC on an appointment basis?\n";
$body .= "$_POST[three]\n";
$body .= "Do you have occasion to reference the Virtual
Library?<br>\n";
$body .= "$_POST[four]\n";
$body .= "Do you require access collections other than those
available?\n";
$body .= "$_POST[fivea]\n";
$body .= "If so, please indicate which collections\n";
$body .= "$collection\n";
$body .= "Comments\n";
$body .= "$_POST[comments]\n";

$crlf = "\r\n";
$hdrs['From'] = 'a********@home.ca';
$hdrs['To'] = 't******@home.ca';
$hdrs['Subject'] = "TDC Survey for $_POST[year]";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($body);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('t******@home.ca', $hdrs, $body);
Jul 16 '05 #1
4 9419
Sylvie Stone wrote:
Can someone PLEASE take a look and tell me why carriage returns are
not being inserted after each $body ? The email comes out as one big
line.

This is a complete guess, but perhaps your boss' Windows email client is not
properly translating \n to \r\n. Try an explicite \r\n and see what
happens. A simpler way to do that, instead of doing $body .= "...\r\n" a
bunch of times is:

$body = array();
$body[] = "....";
$body[] = ".....";

$body = join ( "\r\n", $body );
--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.

Jul 16 '05 #2
"stephan beal" <st*****@wanderinghorse.net> wrote in message
news:bg**********@ork.noris.net...
Sylvie Stone wrote:
Can someone PLEASE take a look and tell me why carriage returns are
not being inserted after each $body ? The email comes out as one big
line.



if you use phpmailer, you can use altbody to create a text only message
Jul 16 '05 #3
We had the same problem with MS Outlook. It simply decided it makes the
text nicer and joined the lines. It showed a hint that some line break
were removed, but we have overlooked it and spent some long minutes
playing with \n and \r.

Ondrej

Sylvie Stone wrote:
Hi All - I have created a survey and I would like the results of the
survey to be emailed the boss in *plain text*.

Can someone PLEASE take a look and tell me why carriage returns are
not being inserted after each $body ? The email comes out as one big
line.

THANK YOU! Sylvie.

include('Mail.php');
include('Mail/mime.php');
$body .= "Are you aware that SCC has a TDC?\n";
$body .= "$_POST[one]\n";
$body .= "Do you know that our resources are available to clients
outside of SCC on an appointment basis?\n";
$body .= "$_POST[three]\n";
$body .= "Do you have occasion to reference the Virtual
Library?<br>\n";
$body .= "$_POST[four]\n";
$body .= "Do you require access collections other than those
available?\n";
$body .= "$_POST[fivea]\n";
$body .= "If so, please indicate which collections\n";
$body .= "$collection\n";
$body .= "Comments\n";
$body .= "$_POST[comments]\n";

$crlf = "\r\n";
$hdrs['From'] = 'a********@home.ca';
$hdrs['To'] = 't******@home.ca';
$hdrs['Subject'] = "TDC Survey for $_POST[year]";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($body);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('t******@home.ca', $hdrs, $body);


Jul 16 '05 #4
"Sylvie Stone" <sy*********@canada.com> wrote in message
news:18**************************@posting.google.c om...

Can someone PLEASE take a look and tell me why carriage returns are
not being inserted after each $body ? The email comes out as one big
line.
<snip>
$body .= "Do you have occasion to reference the Virtual
Library?<br>\n";


If the email comes out as one big line it is because you are lacking line
breaks <br>, which are not the same as new-line (\n). The only place you seem
to have a line break is on the single line quoted above. The new-line
character creates a line break in your resultant source code...not the HTML
output.

Try EITHER:
a) Changing each instance of \n to <br>\n
b) Running the output through nl2br()

HTH!
Jul 16 '05 #5

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

Similar topics

11
4931
by: Inkiniteo | last post by:
Hi guys. I have a script that sends the info by email, but i'd like to avoid the convertion to HTML by the email client or Gmail, because it ruins all the formatting i did (with tabs, mostly)....
8
5274
by: LRW | last post by:
I'm not sure this message is totally appropriate for this group, so please, if anyone has a better group suggestion, let me know! My company sends out a monthly newsletter in HTML format to our...
5
2608
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
1
1763
by: purnashree | last post by:
Hi, I urgently want the sample working code to send emails in vb.net platform with all the namespaces and specifications if possible since i am new to vb.net
1
1401
by: rogers | last post by:
Hi, For my company, I am building a database to log product and software faults What happens is, when we do R&D on a product or piece of software or we find the fault out in the field somewhere, we...
1
3623
by: rciiipo | last post by:
I have a question that is similar to a thread started by pauljhorak; however, my needs are a bit different / possibly more complicated. I have several files stored as outlook items (.msg). I...
0
3115
ck9663
by: ck9663 | last post by:
guys...i got tired searching the net for some reference...this is what i have so far: set @@tableHTML = ' <p>some code</p> <p>some code</p> <table> <tr> ...
4
9607
by: jimatqsi | last post by:
I am trying to print UPS shipping labels using a Zebra label printer. Apparently these printers have the label form programmed into the firmware and all I have to do is send a particular string of...
0
3236
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
7098
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
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.