public static function sendHtmlToKindle($sendTo, $from, $url, $htmlText = '', $isImageEnabled = true)
 {
     $htmlContents = new HtmlContents(new DirectoryBuilder(), $isImageEnabled);
     if ($htmlText) {
         $htmlContents->setIsExtractEnabled(false);
         $htmlContents->fromText($url, $htmlText);
     } else {
         $htmlContents->fromUrl($url);
     }
     $kindleFile = $htmlContents->convertToKindleFile();
     if (!$kindleFile) {
         d(['kindlefileが作成できませんでした', $url, $sendTo, $from, $isImageEnabled, !empty($htmlText)]);
         return false;
     }
     $ret = self::sendMail($sendTo, $from, $kindleFile);
     $htmlContents->destroy();
     return $ret;
 }
 public function test()
 {
     $filename = 'html_utf8.html';
     $html = $this->loadDat($filename);
     $url = 'http://php.net/manual/ja/language.namespaces.rationale.php';
     $setdto = '*****@*****.**';
     $from = '*****@*****.**';
     $htmlContents = new HtmlContents(new DirectoryBuilder());
     $htmlContents->fromText($url, $html);
     //		$htmlContents->fromUrl($url);
     $kindleFile = $htmlContents->convertToKindleFile();
     $mail = new Mail();
     $mail->setSendto($setdto);
     $mail->setFileName('kindle.mobi');
     $mail->setFrom($from);
     $mail->setFile($kindleFile);
     $ret = $mail->send();
     d('' . $mail);
     d($ret);
     $htmlContents->destroy();
     $this->assertEquals(1, 1);
 }