Unintended line breaks in text being emailed.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've this problem where I need to put a list of form text field
results into a single line (for a pipe-separated text file), and
emailed to me...but when I get the e-mail, the single line is broken
into three lines with some duplicate info at the start of each line.
The line breaks happen where there's a space in the text...but not
every space creates a line break.

For example:
154|Wal-Mart |12345|3/8/2009|3/8/2009|1:00 PM|3:00 PM|2100 N. Main
St.||Springfield|XZ|12345|Mike Smith|123-555-1234|mike@foo.com|538 -
Old Mill Trails|1

ends up looking like this in the email:

154|Wal-Mart |12345|3/8/2009|3/8/2009|1:00 PM|3:00 PM|2100 N.
154|Main St.||Springfield|XZ|12345|Mike
154|Smith|123-555-1234|mike@foo.com|538 - Old Mill Trails|1

See, duplicate "154|" get stuck at the beginning of each new line.

The PHP side is:
            Add code:\n

(There's a mix of inline strings, breaks with strings, and _POSTs
because I've been trying different things to fix it, and all methods
produce the same result.)

Any ideas? I'd appreciate it!

Re: Unintended line breaks in text being emailed.

Quoted text here. Click to load it

there is a maximum line length for emails.

Try a transfer encoding, or send as attachment.


Re: Unintended line breaks in text being emailed.

Mechphisto escribió:
Quoted text here. Click to load it

Most e-mail clients wrap long lines when *displaying* them on screen,
make sure that's not the only issue.

Whatever, the SMTP specs specify a maximum line length so plain text
mail parts are likely to be wrapped. You have to use base64 or a similar
encoding with the appropriate headers, e.g.:

         Content-Type: text/plain; charset=ISO-8859-1
         Content-transfer-encoding: base64



-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com

Re: Unintended line breaks in text being emailed.

On Mar 3, 2:17 am, "=C1lvaro G. Vicario"
Quoted text here. Click to load it
Ah! That makes sense.
I tried the base64, and yeah, it encodes the text into human
unreadable code. I m sure if I wrote a script where I plugged it in to
decode64 I could read the e-mail. But that seems like a hassle.
I guess what I'll do is just break the line up into multiple lines in
the e-mail, then when I receive them, I'll just copy-n-paste each
segment into one line. It's a tiny hassle, but better than dealing
with the way it was munging up before.
Thanks for replying!

Site Timeline