Munged formatting and line wrap (UPDATED)

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
Douglas_Morris
Forum Newbie
Posts: 4
Joined: Fri Nov 02, 2007 3:56 am

Munged formatting and line wrap (UPDATED)

Post by Douglas_Morris »

Heyya All,

First off, I did a little digging in the forums and found one item that seems to match my problem. It would seem that GPG messages (despite only being 65 character long lines) get munged all to hell by Swift. I tried the work around mentioned in the post concerning PGP/GPG to no avail, but was able to solve the problem by saving the message to a text file and putting it into the email as a text/plain attachment. Once done Swift did not try to reformat it anymore. This solution works, but adds unneeded extra info to the email as well as making it MIME which is just not needed.

Once getting through all that and focusing on the customer email that this script sends out, I realized all my nice formatting (again just plain text and spaces formatting) was completely messed up. My tables and formatting simply destroyed. I am starting to wonder if perhaps this has something to do with replacement or alteration of /n vs. /r/n or something to that extent. I would really like (perhaps i have missed it) a way to tell swift to not try to reformat the message body and to just leave it alone and assume I know what I am doing.

Any thoughts or ideas would be greatly appreciated.

Douglas Morris
Last edited by Douglas_Morris on Fri Nov 02, 2007 11:59 am, edited 1 time in total.
Douglas_Morris
Forum Newbie
Posts: 4
Joined: Fri Nov 02, 2007 3:56 am

Post by Douglas_Morris »

UPDATE:

Just an intresting update of information that I can not explain. It seems that on another email that i am running through it only munges part of it. There are some really long lines at the start that are not messed with at all, but once you get about 40 lines into the email, it seems to have taken all the cr/lf out of the email and all the lines just run together after that when viewing the email in Thunderbird.

What is even more intresing is if you do a Crtl-J and view the source, the formatting is perfect in the source. No issues at all. Also, if you look at it in gmail, it looks completely fine.

And to top if all off, if you send it using the built in phpmailer it looks completely fine in All of the above situations with no issues anywhere, so clearly swift is doing something, and what ever that something is, is making Thunderbird tempermental. I am completely lost as to what could be causing this, and hope someone has some clever ideas.

Doug
Douglas_Morris
Forum Newbie
Posts: 4
Joined: Fri Nov 02, 2007 3:56 am

Post by Douglas_Morris »

UPDATE 2:

Well, back to the wall of wierd. I have determined what causes it to munge some lines and not munge others. It would seam that any line that ends with a blank space " " that is then followed by a \n or a \r\n has that new line option ignored when it makes it's way into the Thunderbird viewer. As much as I still want to blame this on Thunderbird, I am still baffled as to why this is occuring with swift and not with phpmail. Also, this explains completely why the GPG encode is getting munged as every line ends in a space.

I sure hope this helps put someone else on the right path as I am just guessing here for all I am worth.

Doug Morris
Douglas_Morris
Forum Newbie
Posts: 4
Joined: Fri Nov 02, 2007 3:56 am

Post by Douglas_Morris »

Update 3:

Ok, I have found a solution to make the GPG encoded data not get munged when it gets to thunderbird. I have added the line

$message->headers->set("Content-Transfer-Encoding", "text/plain");

to the email setup and that seems to keep Thunderbird happy.

It has not solved the problem with the " \n" being turned into nothing more than a space where as "\n" gives a new line, but at least I have a working, tho intresting, solution.

Doug
prazgod
Forum Newbie
Posts: 1
Joined: Fri Aug 22, 2008 7:31 am

Re: Munged formatting and line wrap (UPDATED)

Post by prazgod »

I had a similar issue today.

However, I pinned it down to sending by SMTP. When I sent using the SMTP connector the GPG string had additional line breaks in it

When I send the exact same email using phpmail connector I get no line breaks....

same with you? what connector are you using?
Post Reply