2016-07-07 2 views
1

이미지를 MimeBodyPart.INLINE으로 추가 할 때 아이폰 이외의 첨부 파일이 잘 나타나는데, javamail을 사용하여 이미지를 서명으로 첨부하는 가장 좋은 방법은 무엇입니까? 내가 "imagePart"를 제거하면 는, 다른 모든 첨부 파일은 내가 사용도를Javamail을 사용하여 인라인 이미지를 첨부 할 때 iphone에서 첨부 파일을 읽을 수 없습니다.

작업 :

MimeMessage m = new MimeMessage(session); 
    MimeMultipart content = new MimeMultipart("related"); 

    // ContentID is used by both parts 
    String cid = ContentIdGenerator.getContentId(); 

    // HTML part 
    String textPartSaine = Tools.convertSymbolToUTF8(emailContenu, true); 
    MimeBodyPart textPart = new MimeBodyPart(); 
    textPart.setText("<html><head>" 
    + "<title></title>" 
    + "</head>\n" 
    + "<body>" 
    + "<div>"+ textPartSaine.replaceAll("\n", "<BR/>") +"</div><BR/><BR/>" 
    + "<div><img src=\"cid:" 
    + cid 
    + "\" /></div><BR/><BR/>" + "</body></html>", 
    "US-ASCII", "html"); 
    content.addBodyPart(textPart); 

    // Image part 
    if(signature != null && signature.exists()){ 
     MimeBodyPart imagePart = new MimeBodyPart(); 
     imagePart.attachFile(signature); 
     imagePart.setContentID("<" + cid + ">"); 
     imagePart.setDisposition(MimeBodyPart.INLINE); 
     content.addBodyPart(imagePart); 
    } 

    if(fichiers != null && fichiers.length > 0) { 
     for(i = 0; i < fichiers.length; i++) { 
      partie = new MimeBodyPart(); 
      partie.attachFile(fichiers[i]); 
      content.addBodyPart(partie); 
     } 
    } 

감사를

다중/혼합 (텍스트 및 첨부 파일이 포함 된 것) 다중/대안

답변

0

해결 (윌 텍스트 및 HTML 포함) 멀티 파트/관련 (HTML + 포함 된 이미지) image1 (콘텐츠 -ID : xxx) image2 ... 첨부 1 첨부 2 ...

관련 문제