cakePHP inline Attachment

eMail mit Inline Anhang versenden (cakePHP 2.2.4)

public function sentMailTo() {

App::uses('CakeEmail', 'Network/Email');

//config email in /app/Config/email.php

$email = new CakeEmail('smtp', 'templated');
$email->attachments(array(
            'image.jpg' => array(
                'file' => WWW_ROOT . '/img/image.jpg',
                'mimetype' => 'image/jpg',
                'contentId' => 'cid:part111' //src="cid:part111"
            )
        ));

        $email->viewVars(array(
            'vars' => $vars,
        ));

        $email->emailFormat('html');
        $email->subject('subject');
        $email->to($to);
        $email->template($template);
        $email->emailFormat('html');
        $email->from($from);
        try {
            $email->send();
        } catch (Exception $e) {
            trigger_error("ERROR in Controller::function sendMailTo: couldn't send mail to: $to}.");
            return false;
        }
}