Line break after 70 characters in text emails

Solutions for other advanced phplisters

Line break after 70 characters in text emails

Postby Xavior » 8:12am, Fri 10 Nov, 2006

Hi, I recently installed phplist and have found that line breaks are automatically inserted after approximately 70 characters per line, causing the emails to look odd/distorted on smaller resolutions.

This applies to subscription confirmation emails as well as any other text only emails. Is this something that can be configured through available settings or is it just a bug/limitation of the system?

Thanks!
Xavior
phpList newbie
 
Posts: 3
Joined: 8:06am, Fri 10 Nov, 2006

Postby Xavior » 8:16am, Fri 10 Nov, 2006

While I'm at it, I also want to ask another question. All list members have FirstName & LastName attributes. When I send out an email, I want it to start out with:

"Dear FirstName LastName,"

How do I make use of these attributes when composing my email? I'm assuming I would use a similar format to the unsubscribe links, but I can't find any documentation to that effect. Will something like: "Dear [FirstName] [LastName]," work?

Thank again :)
Xavior
phpList newbie
 
Posts: 3
Joined: 8:06am, Fri 10 Nov, 2006

Postby Xavior » 5:27pm, Mon 13 Nov, 2006

any ideas on either of these two issues?
Xavior
phpList newbie
 
Posts: 3
Joined: 8:06am, Fri 10 Nov, 2006

Re: Line break after 70 characters in text emails

Postby H2B2 » 7:21pm, Mon 13 Nov, 2006

Xavior wrote:Hi, I recently installed phplist and have found that line breaks are automatically inserted after approximately 70 characters per line, causing the emails to look odd/distorted on smaller resolutions.
I'm not sure what might be causing this on your system. It doesn't occur on mine, though I remember having seen one or two similar reports on the forum, e.g. http://forums.phplist.com/viewtopic.php?t=4952

You could try searching the forum for 'line breaks' or 'wordwrap' and see what comes up.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby H2B2 » 7:24pm, Mon 13 Nov, 2006

Xavior wrote:Will something like: "Dear [FirstName] [LastName]," work?
Yes, using 'placeholders' like that should work. Still, some users mention having problems using custom placeholders in text messages, while having no problem with using them in html messages.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Emily » 7:19pm, Tue 10 Apr, 2007

Greetings!

I was faced with the same problem - it seems like most modern email programs should be able to handle unwrapped text (someone please correct me if I'm wrong!).

In the file class.phplistmailer.php, change the $WordWrap variable to 0 to turn off word wrapping.

Hope this helps!

Emily
Emily
phpLister
 
Posts: 10
Joined: 4:23pm, Mon 13 Nov, 2006
Location: Spring Hill, FL

Postby thisisit3 » 9:30pm, Thu 03 May, 2007

I also had the same problem, my text emails would be word wrapped at 75 characters.

I edited the file class.phplistmailer.php as mentioned about and its not working properly.

Thank you!
thisisit3
PL Nut
 
Posts: 27
Joined: 12:32pm, Thu 26 Apr, 2007

Postby Emily » 1:57am, Tue 08 May, 2007

Hi,

Are you certain you edited the right file? There's another file with a similar name and similar settings... here's a little snippet of the text nearby:

Code: Select all
class PHPlistMailer extends PHPMailer {
    var $isText = false;
    var $WordWrap = 0;
    var $encoding = 'base64';


The other file which is similarly named and has the same variable defined looks much different.

Hope this helps!

Emily
Emily
phpLister
 
Posts: 10
Joined: 4:23pm, Mon 13 Nov, 2006
Location: Spring Hill, FL

Postby thisisit3 » 6:25am, Tue 08 May, 2007

sure, here is my patch:

Code: Select all
--- ./class.phplistmailer.php.orig      2007-05-04 00:26:52.000000000 +0300
+++ class.phplistmailer.php     2007-05-04 00:26:31.000000000 +0300
@@ -5,7 +5,7 @@

 class PHPlistMailer extends PHPMailer {
     var $isText = false;
-    var $WordWrap = 75;
+    var $WordWrap = 0;
     var $encoding = 'base64';
     var $image_types = array(
                   'gif'  => 'image/gif',
thisisit3
PL Nut
 
Posts: 27
Joined: 12:32pm, Thu 26 Apr, 2007

Postby Emily » 12:24pm, Tue 08 May, 2007

Another thought... are you having phplist create the text version, or are you putting it in yourself? I was thinking if phplist is creating it, maybe it's wrapping it for you in the process? I've not investigated that part as I do the text version myself.

Emily
Emily
phpLister
 
Posts: 10
Joined: 4:23pm, Mon 13 Nov, 2006
Location: Spring Hill, FL

Postby thisisit3 » 2:23pm, Tue 08 May, 2007

I do the text version myself, as far as i know anyway (i've disabled HTML emails in my phplist).
thisisit3
PL Nut
 
Posts: 27
Joined: 12:32pm, Thu 26 Apr, 2007

Re: Line break after 70 characters in text emails

Postby bezraznizi » 3:06pm, Thu 27 Dec, 2012

For the ones who still stumbles this besides setting WordWrap=0 everywhere but in vain...

For the messages, which you creating as html without text-version PHPList makes text-version itself if needed an do that according its sending algorithm automatically.
And the thing is that process includes converting html to plain text by replacing all tags and other html-stuff from message.
The method is on duty for that called function stripHTML($text) in ..admin/sendmaillib.php file.
At the very end of this function there is a line:
Code: Select all
function stripHTML($text) {
   ...
   ...
  # reduce whitespace
  while (preg_match("/  /",$text))
    $text = preg_replace("/  /"," ",$text);
  while (preg_match("/\n\s*\n\s*\n/",$text))
    $text = preg_replace("/\n\s*\n\s*\n/","\n\n",$text);
    $text = wordwrap($text,70);

  return $text;
}


$text = wordwrap($text,70); - this is our guy who makes all shit. Commenting it resolves the odd wrapping plain-text message version effect.

It's very strange why developers hardcoded that value. It makes a lot of timewaste and negative when declared settings has no effect and you have to dig in to find out how to get the elementary things work the way they was exactly designed.
bezraznizi
phpList newbie
 
Posts: 2
Joined: 7:42am, Sun 24 Jan, 2010


Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest