How to fix the CakePHP 1.2 RC1 Email sender problem

After I upgraded from CakePHP 1.2 to the new CakePHP 1.2 RC1 my emails started to show all the header information instead of just the relevant message.

After a LONG time of searching the web, I have not found an answer so I started to investigate my self.

I started to look at the Email component and didn’t see any changes that should make a difference until I got to the $_newLine variable.

It used to be $_newLine = “\n”; but now it is $_newLine = “\r\n”; which apparently does not get interpreted by Gmail well. I don’t know how other email services behave, I just tested with Gmail.

So to fix this issue you want to add this line when you are assembling an email anywhere before the send call.

$this->Email->_newLine = "\n";

This will over ride the faulty default setting.