473,657 Members | 2,513 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.p hp');
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.c a';
$hdrs['Subject'] = "TDC Survey for $_POST[year]";
$mime = new Mail_mime($crlf );
$mime->setTXTBody($bo dy);
$body = $mime->get();
$hdrs = $mime->headers($hdrs) ;
$mail =& Mail::factory(' mail');
$mail->send('t******@ home.ca', $hdrs, $body);
Jul 16 '05 #1
4 9433
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*****@wander inghorse.net> wrote in message
news:bg******** **@ork.noris.ne t...
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.p hp');
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.c a';
$hdrs['Subject'] = "TDC Survey for $_POST[year]";
$mime = new Mail_mime($crlf );
$mime->setTXTBody($bo dy);
$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*********@ca nada.com> wrote in message
news:18******** *************** ***@posting.goo gle.com...

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
4950
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). Briefing, i wanna be able to send SMTP mail and the receiver only get it in plain text.
8
5295
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 account holders. We get a couple of people with auto-responders saying they don't accept HTML e-mails, please send plain-text. Is there some way to format an e-mail with both versions, maybe defaulting to HTML format but display plain-text if it...
5
2624
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 depending on member expiration dates. When the form is submitted, the code loops through the form contents and sends an email to those members that meet the selected criteria. All this worked perfectly when I was sending text emails, but since I
1
1769
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
1414
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 input all this data into the main form, along with pictures, config files, or pdf reports etc etc. I have a button on the main form that when pressed, exports the required data into a plain text outlook email, ready for editing or sending to our...
1
3635
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 would like to place keywords inside the .msg body section that I can replace with field values from my table. For example, name, greetings, etc. The to: field in the message will also come from field values. Also, I need to post a table into the...
0
3136
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> <td>some header1 here</td> <td>some header2 here</td> </tr>
4
9637
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 text to the port the printer is connected to (USB) and voila, the printer makes the label correctly. How do I send unformatted text to a printer port using MS Access? I've got version 2003 in a Win XP environment. Thanks! Jim
0
3255
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 text at 69 characters on Tools | Options | Mail Format | Internet Format | Plain text options. Outlook does not seem to honor this setting. I tried various different encodings for the message including US-ASCII. On advice from a Microsoft page...
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.