protected function addInlineImagesToMessage(\Swift_Message &$message, $fieldhtml)
 {
     $regex = '~data:[^;]+;[A-Za-z0-9]+,[^")\'\\s]+~';
     preg_match_all($regex, $fieldhtml, $treffers, PREG_OFFSET_CAPTURE);
     $treffers = $treffers[0];
     foreach ($treffers as $treffer) {
         $trefferexpl = explode(',', $treffer[0], 2);
         $data = explode(';', $trefferexpl[0]);
         $data = explode(':', $data[0]);
         $mimetype = $data[1];
         $decoded = base64_decode($trefferexpl[1]);
         $image = new \Swift_Image();
         $image->setBody($decoded, $mimetype);
         $cid = $message->embed($image);
         $fieldhtml = str_replace($treffer[0], $cid, $fieldhtml);
     }
     $message->setContentType("text/html")->setBody($fieldhtml, 'text/html');
     return true;
 }