Swift Mailer & Line Breaks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Swift Mailer & Line Breaks

Post by akreider »

d11wtq | This thread has been split from a deceased thread

I am having some trouble with line breaks. Swift Mailer (ver 1.21 for php 4) is adding line breaks.

**Original Text**
Felicia Perkins
Trinity, Alabama
http://www.campusactivism.org/displayperson-3990.htm


**SwiftMailer Output**
Felicia
Perkins
Trinity,
Alabama
http://www.campusactivism.org/displayperson-3990.htm

Not sure if this was fixed in a more recent version? I haven't upgraded, because of the frequency of new versions.

I tried using the regular php mail() function and that works fine.

For line breaks, I'm using \n.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

If these are long(ish) lines it's not a bug, Swift had auto-compliance on by default in older versions (breaks long lines to be under the 76 char limit). It's no longer on by default.

You can turn it off with $swift->useAutoLineResizing(false). If that doesn't work you may want to post the code.

BTW: \n gets converted to \r\n internally with Swift in any case

Also note that version 2 has been available for over a month... ;)

EDIT | RE frequency of new versions. I'm currently having a version freeze for a month or so at least unless something critical crops up. I would advise upagrading. You have an awfully young version of the code.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post by akreider »

Umm, they aren't long lines. "Felicia Parkins" is less than 20 characters and got split up.

I'll try the new version and let you know.

Aaron
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post by akreider »

I fixed the problem in the old version by replacing all my /n with /r/n - apparently Swift wasn't doing a good job of replacing them on its own (at least in 1.2).
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

akreider wrote:I fixed the problem in the old version by replacing all my /n with /r/n - apparently Swift wasn't doing a good job of replacing them on its own (at least in 1.2).
To be honest (I haven't dug that old version up to check) I'm not even sure early revisions of 1.2 implemented the LF --> CRLF compatabililty. That would make sense for the issue to. Some SMTP servers attrempt to do the replacement but they often end up making a mess of it :) :twisted:
Post Reply