Page 1 of 1

Plain text wrapping/line lengths

Posted: Sat Jun 30, 2007 10:52 pm
by majiga
Hi everyone,

A question about line lengths on plain text versions of emails sent with swiftmailer. Thus far I don't have any line length stuff sorted out, and so when I send an email to my gmail account and then click "Message text garbled?" to display the plain text version, all the long lines extend far out past the width of my monitor.

Is it best for me to put in some code to wrap lines to 72 (?) characters before I actually transmit them, or is it just best to send the plain text versions with really long lines and then just let the client wrap them for display? (The fact that gmail doesn't do this, makes me think I should be doing the former).

I couldn't even test this in Outlook; how can i get the plain text version to display in Outlook 2003? If I open the email up (double click), and then choose the Format menu; it has the options for Plain Text and HTML greyed out, with a tick next to HTML; which indicates to me that outlook doesnt think there's a plain text version of the email present.

Any ideas?

Thanks heaps!

Posted: Sat Jun 30, 2007 11:08 pm
by superdezign
Wrap it to 70 characters.

Posted: Sat Jun 30, 2007 11:14 pm
by majiga
is there a recommended way to do this?

I've found this function:

http://www.weberdev.com/get_example-164.html

which looks like it'll do the trick. is there a better way?

cheers

Posted: Sun Jul 01, 2007 5:44 am
by Stryks
Sorry, cant add much in the way of a solution, but I reading your post, I just had to comment.
I couldn't even test this in Outlook; how can i get the plain text version to display in Outlook 2003? If I open the email up (double click), and then choose the Format menu; it has the options for Plain Text and HTML greyed out, with a tick next to HTML; which indicates to me that outlook doesnt think there's a plain text version of the email present.
Ya know ... I found this too, and it is REALLY frustrating.

Outlook seems to ticks the version you are seeing, and wont let you change whether there is a text component or not.

If you're trying to test your emails for structure and mutipart views, move on up in the world and get yourself Thunderbird.

Source view is easily accessible, includes full headers and it allows switching between HTML and text parts with ease.

Posted: Sun Jul 01, 2007 6:12 am
by superdezign
wordwrap()

Plain text emails can't use the <br /> line break. You must use word wrap and wrap to 70 characters with "\r\n" as the break.

Posted: Sun Jul 01, 2007 7:54 am
by Chris Corbyn

Code: Select all

$message->setLineWrap(70);

//and/or

$part->setLineWrap(70);
There are some constants to provide lengths of 70 and 1000 but they're not really useful anyway.

Posted: Sun Jul 01, 2007 8:13 am
by superdezign
d11wtq wrote:

Code: Select all

$message->setLineWrap(70);

//and/or

$part->setLineWrap(70);
There are some constants to provide lengths of 70 and 1000 but they're not really useful anyway.
I would assume they use wordwrap? :P
I couldn't find your documentation for line wrapping, so I just use wordwrap manually.

Posted: Sun Jul 01, 2007 8:37 am
by majiga
d11wtq wrote:

Code: Select all

$part->setLineWrap(70);
That did the job! Thanks heaps!