0

我可以使用 javax.mail 库创建一个 .eml 文件,但如果正文长度超过 76 个字符,则它会分成更多行。问题在于使用 Windows Live Mail 打开 .eml 文件后,“=”字符出现在电子邮件正文中的 76 个字符的对应关系中,并且文本位于多行上。

有人可以帮我吗?谢谢

-安东尼奥

这是 .eml 示例文件:

X-Unsent: 1
Message-ID: <2037894577.5.1365866504487.JavaMail.Nunziante@Nunziante-TOSH>
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 文件时,消息是:

斯特拉特福半身像位于埃文河畔斯特拉特福的圣三一教堂的墙上,是最古老的,与 Droeshout Port=ait 一起,是所有已知莎士比亚形象中最可信的。但是,在整个 c=nturies 中流传下来的吟游诗人有 m=ny 的表现形式,每个都有自己迷人的故事要讲述。. Responsabilità= Generica

为了获得确切的身体,我必须设置什么?谢谢

4

1 回答 1

0

听起来您没有提供正确的标题。如果正文部分在 QP 中,您需要一个Content-Transfer-Encoding: quoted-printable正文部分标头来指示客户端。

如果您需要更多帮助,问题消息的来源将有助于诊断。正确的最小多部分消息如下所示:

From: me@example.net
To: you@site.example.co
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 通常会添加它们。)

于 2013-04-13T12:55:00.693 回答