Skip to content

Instantly share code, notes, and snippets.

@oh-sky
Forked from slywalker/Base64Email.php
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oh-sky/8994181 to your computer and use it in GitHub Desktop.
Save oh-sky/8994181 to your computer and use it in GitHub Desktop.
<?php
App::uses('CakeEmail', 'Network/Email');
class Base64Email extends CakeEmail {
protected function _renderTemplates($content) {
$rendered = parent::_renderTemplates($content);
array_walk($rendered, function(&$val, $key) {
$val = chunk_split(base64_encode($val), 76, "\n");
});
return $rendered;
}
protected function _getContentTransferEncoding() {
return 'base64';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment