/**
  * test line end encoding of Zend_Mime_Part / Smtp Protocol
  */
 public function testSendWithWrongLineEnd()
 {
     $config = TestServer::getInstance()->getConfig();
     $mailDomain = $config->maildomain ? $config->maildomain : 'tine20.org';
     // build message with wrong line end rfc822 part
     $mail = new Tinebase_Mail('utf-8');
     $mail->setBodyText('testmail' . "\r\n" . "\r\n");
     $mail->setFrom('unittest@' . $mailDomain, 'unittest');
     $mail->setSubject('line end test');
     $mail->addTo('unittest@' . $mailDomain);
     $mail->addHeader('X-Tine20TestMessage', 'lineend');
     // replace EOLs
     $content = file_get_contents(dirname(dirname(__FILE__)) . '/files/text_plain.eml');
     $content = preg_replace("/\\x0a/", "\r\n", $content);
     $stream = fopen("php://temp", 'r+');
     fputs($stream, $content);
     rewind($stream);
     $attachment = new Zend_Mime_Part($stream);
     $attachment->type = Felamimail_Model_Message::CONTENT_TYPE_MESSAGE_RFC822;
     $attachment->encoding = null;
     $attachment->charset = 'ISO-8859-1';
     $attachment->filename = 'attach.eml';
     $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
     $mail->addAttachment($attachment);
     $smtpConfig = $this->_account->getSmtpConfig();
     $transport = new Felamimail_Transport($smtpConfig['hostname'], $smtpConfig);
     Zend_Mail_Protocol_Abstract::$loggingEnabled = true;
     $mail->send($transport);
     Zend_Mail_Protocol_Abstract::$loggingEnabled = false;
     $smtpLog = $transport->getConnection()->getLog();
     $badLineEndCount = preg_match_all("/\\x0d\\x0d\\x0a/", $smtpLog, $matches);
     $this->assertEquals(0, $badLineEndCount);
     $badLineEndCount = preg_match_all("/\\x0d/", $smtpLog, $matches);
     $this->assertTrue(preg_match_all("/\\x0d/", $smtpLog, $matches) > 70, 'unix line ends are missing');
 }