2013-04-13 1 views
0

javax.mail 라이브러리를 사용하여 .eml 파일을 만들 수 있지만 본문이 76자를 초과하면 더 많은 줄이 끊어집니다. 문제는 Windows Live Mail에서 .eml 파일을 여는 것보다 '='문자가 전자 메일 본문에 76 자의 일치로 나타나고 텍스트가 여러 줄로 표시됩니다.MimeMessage body longer 76 chars

아무에게 도와 줄 수 있습니까? 감사합니다

-Antonio

이이 .eml 인 예제 파일입니다

X-Unsent: 1 
Message-ID: <[email protected]> 
Subject: Comunicazione Contenzioso Spedizione 8092255513 del 09-04-2013 
MIME-Version: 1.0 
Content-Type: multipart/mixed; 
boundary="----=_Part_4_1091659763.1365866499167" 

------=_Part_4_1091659763.1365866499167 
Content-Type: text/plain; charset=UTF-8 
Content-Transfer-Encoding: quoted-printable 

The Stratford Bust, located on the wall of the chancel of Holy Trinity Chur= 
ch at Stratford-upon-Avon, is the oldest and, along with the Droeshout Port= 
rait, most credible of all the known images of Shakespeare. But there are m= 
any representations of the Bard that have been handed down throughout the c= 
enturies, each with its own fascinating story to tell.. Responsabilit=C3=A0= 
: Generica 


------=_Part_4_1091659763.1365866499167-- 

이 내 현재 코드입니다 :

Message message = new MimeMessage(javax.mail.Session.getInstance(System.getProperties())); 
message.setFrom(new InternetAddress(from)); 
message.setRecipients(Message.RecipientType.TO, getAddress(to)); 
message.setSubject(subject); 
Multipart multipart = new MimeMultipart(); 
MimeBodyPart content = new MimeBodyPart(); 
multipart.addBodyPart(content); 
content.setText(body); 
message.setContent(multipart); 
FileOutputStream fos = new FileOutputStream(emlFile); 
message.writeTo(fos); 
fos.close(); 

나는 EML 파일을 열

의이 메시지는 다음과 같습니다 :

Chanc의 벽에있는 Stratford Bust Stratford-upon-Avon에있는 Holy Trinity Chur = el의 가장 오래된 섬이며, Droeshout Port = ait와 함께 셰익스피어의 모든 알려진 이미지를 가장 신뢰할만한 곳입니다. 그러나 각자의 매혹적인 이야기를 들려주는 바드의 묘사가 있습니다 .. Responsabilità = Generica

정확한 신체를 얻으려면 무엇을 설정해야합니까? ? 감사합니다.

+0

이 내 문제를 해결하기 :을 내용으로 올바른 최소한의 다중 메시지는 다음과 같이 보입니다 .setHeader ("Content-Transfer-Encoding", "base64"); – user1047400

답변

0

올바른 헤더를 제공하지 않은 것 같습니다. 본문 부분이 QP에있는 경우 Content-Transfer-Encoding: quoted-printable 본문 부분 헤더가 있어야 클라이언트에 지시 할 수 있습니다.

도움이 더 필요하면 문제가있는 메시지의 출처가 진단에 유용합니다.

From: [email protected] 
To: [email protected] 
Subject: privet, mir 
Mime-Version: 1.0 
Content-type: multipart/mixed; boundary=foo 

--foo 
Content-type: text/plain; charset=utf-8 
Content-Transfer-Encoding: quoted-printable 

Hello w= 
orld. 

--foo-- 

(엄밀히 Date:Message-Id:을 말하는 것은 너무, 필수,하지만이없는 경우 MTA는 일반적으로 추가됩니다.)

+0

답변 해 주셔서 감사합니다. 그러나 Mime 메시지를 올바르게 설정하는 방법을 이해하지 못했습니다. 나는 나의 현재 코드와 eml 파일 내용을 소개하는 나의 이전 질문을 편집했다 ... 나는 그것이 내 상황을 깨끗이 해주기를 바란다 ... – user1047400

+0

나는 body 부분을위한 QP를 올바르게 설정 한 것 같지만 .. 그러나 eml 파일을 열면 Windows Live Mail에서는 본문에 "="문자가 포함됩니다. – user1047400