简体   繁体   English

MimeMessage正文更长76个字符

[英]MimeMessage body longer 76 chars

I'm able to create a .eml file with javax.mail library, but if the body is longer than 76 characters it's broken in more lines. 我可以使用javax.mail库创建一个.eml文件,但是如果正文长度超过76个字符,则会在更多行中被打断。 The problem is than opening the .eml file with Windows Live Mail the '=' char appears in the email body in the corrispondence of the 76 character and the text is on multiline. 问题是,使用Windows Live Mail打开.eml文件时,“ =”字符以76个字符的对应关系出现在电子邮件正文中,并且文本位于多行上。

Could anyone help me please? 有人可以帮我吗? Thank you 谢谢

-Antonio -安东尼奥

This is the .eml example file: 这是.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--

and this is my current code: 这是我当前的代码:

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();

When I open the eml file, the message is: 当我打开eml文件时,消息是:

The Stratford Bust, located on the wall of the chancel of Holy Trinity Chur=h at Stratford-upon-Avon, is the oldest and, along with the Droeshout Port=ait, most credible of all the known images of Shakespeare. 斯特拉特福胸像位于埃文河畔斯特拉特福的圣三一教堂Chur = h的墙上,是最古老的,与Droeshout Port = ait一样,在所有已知的莎士比亚画像中都是最可信的。 But there are m=ny representations of the Bard that have been handed down throughout the c=nturies, each with its own fascinating story to tell.. Responsabilità= Generica 但是在整个c = nturies中,有m = ny个关于吟游诗人的传世作品,每个都有其独特的故事要讲述。.Responsabilità= Generica

What I have to set in order to obtain the exact body? 我必须设置什么才能获得准确的身体? thanks 谢谢

Sounds like you have not supplied the correct headers. 听起来您没有提供正确的标题。 If the body part is in QP you need a Content-Transfer-Encoding: quoted-printable body part header to instruct the client. 如果主体部分在QP中,则需要Content-Transfer-Encoding: quoted-printable主体部分标头来指示客户端。

If you need more help, the source of a problematic message would be useful for diagnostics. 如果您需要更多帮助,有问题的消息的来源将对诊断很有用。 A correct minimal multipart message looks something like this: 正确的最小多部分消息如下所示:

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--

(Strictly speaking Date: and Message-Id: are mandatory, too, but the MTA will usually add them if they are missing.) (严格来说, Date:Message-Id:也是必填项,但如果缺少它们,MTA通常会添加它们。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM