0

以下のコードを書きました

            MimeMultipart multipart = new MimeMultipart("related");

        // first part  (the html)
        BodyPart messageBodyPart = new MimeBodyPart();
        String htmlText = 
"<img src=\"cid:image\"\\>\n"+
  "<div style=\"position:absolute; left: 150px; top: 298px; width: 248px;\">hello</div>\n"+
  "<div style=\"position:absolute; left: 176px; top: 349px; width: 225px;\">hello</div>\n"+
    "<div style=\"position:absolute; left: 185px; top: 401px; width: 216px;\">hello</div>\n"+
    "<div style=\"position:absolute; left: 167px; top: 514px; width: 232px;\">hello</div>\n";
        messageBodyPart.setContent(htmlText, "text/html");

        // add it
        multipart.addBodyPart(messageBodyPart);

        // second part (the image)
        messageBodyPart = new MimeBodyPart();
        DataSource fds = new FileDataSource("D://a1.jpg");
        messageBodyPart.setDataHandler(new DataHandler(fds));
        messageBodyPart.setHeader("Content-ID","<image>");

        // add it
        multipart.addBodyPart(messageBodyPart);

    // put everything together
        msg.setContent(multipart);
        bus.sendMessage(msg, address);

すべてが正常に機能しており、電子メールも配信されています。唯一の問題は、div要素が画像の上にあるはずであるということです..しかし、受信した電子メールでは、電子メールの絶対部分が省略されています..

何か助けはありますか?

4

1 に答える 1

0

残念ながら、使用できません。メールで表を使用することをお勧めします。見栄えposition: absoluteが良くなります。<table />background-imagecid:imagediv

于 2012-10-11T09:12:39.253 に答える