cakephp/cakephp — pull request #1375 by dereuromark (2013-06-24 13:48:25+00:00)
Title: Prepare boundary in all cases to be safe

Currently, its unfortunate that the boundary value is only calculated prior to the rendering of the HTML layout (which possible can attach more inline images due to included images - e.g. via callback afterLayout as in my case).
But then the boundary value is in some cases not available due to the early decision and as a result the email is invalid.

Either we move the calculation down where the decision can be made with certainty.

Or we also prepare the boundary even if its not needed. It sure does not hurt to do so - but it fixes the issue in a quick way. At least for me the emails were ok again (had to switch to "both" in the meantime here).

We could probably also just remove the if() statement completely.
That is what I then did in the second commit. I think this is the cleanest solution.