Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
3.0.0-beta5
-
None
Description
config as below
<mailet match="All" class="org.apache.james.transport.mailets.AddFooter">
<text>================================add footer=======================</text>
</mailet>
I can get the footer when I use telnet wiht simple message. and I change the email content to text at server just like below code.I think this change the message type.
public void service(Mail mail) throws MessagingException {
try {
MimeMessage message = mail.getMessage();
message.setText("11111111111111111111");
// message.getContent();
if (attachFooter(message))Unknown macro: { message.saveChanges(); }else
Unknown macro: { log("Unable to add footer to mail " + mail.getName()); }} catch (UnsupportedEncodingException e)
Unknown macro: { log("UnsupportedEncoding Unable to add footer to mail " + mail.getName()); }catch (IOException ioe)
Unknown macro: { throw new MessagingException("Could not read message", ioe); }}
But i run the test case of AddFooterTest.java, It is work fine.
I add a test case for the same content of the foxmail client.and the test case is OK.
Test case in AddFooterTest as below
@Test
public void shouldAddFooterWhenMultipartRelatedHtmlMessage4() throws MessagingException, IOException {mailetConfig.setProperty("text", "==========================test case============================");
mailet.init(mailetConfig);String htmlMultipartRelatedMessagePart1 = Joiner.on("\r\n").join(
"MIME-Version: 1.0",
"Received: from 127.0.0.1 (EHLO levi-work) ([127.0.0.1])",
" by levi-work (JAMES SMTP Server ) with ESMTP ID 2126899460",
" for <luolei@linyanyan.cn>;",
" Mon, 16 Jan 2017 14:00:53 +0800 (CST)",
"Date: Mon, 16 Jan 2017 14:00:53 +0800",
"From: \"test@linyanyan.cn\" <test@linyanyan.cn>",
"To: \"luolei@linyanyan.cn\" <luolei@linyanyan.cn>",
"Subject: 01-16-15",
"References: <2017011417484072410935@linyanyan.cn>, ",
" <2017011611300751098536@linyanyan.cn>, ",
" <2017011611571368034137@linyanyan.cn>, ",
" <2017011612310328703438@linyanyan.cn>, ",
" <2017011612342956932739@linyanyan.cn>, ",
" <2017011612433319053540@linyanyan.cn>, ",
" <2017011612452625583641@linyanyan.cn>, ",
" <2017011613055188853642@linyanyan.cn>, ",
" <2017011613071917921943@linyanyan.cn>, ",
" <2017011613080283758744@linyanyan.cn>, ",
" <2017011613094076349445@linyanyan.cn>, ",
" <2017011613184900040846@linyanyan.cn>, ",
" <2017011613210755849247@linyanyan.cn>, ",
" <2017011613371787777048@linyanyan.cn>",
"X-Priority: 3",
"X-Has-Attach: no",
"X-Mailer: Foxmail 7, 2, 7, 26[cn]",
"Content-Type: multipart/alternative;",
" boundary=\"---=001_NextPart801803664644=---\"",
" ",
"This is a multi-part message in MIME format.",
"",
"-----=001_NextPart801803664644=---",
"Content-Type: text/plain;",
" charset=\"ISO-8859-1\"",
"Content-Transfer-Encoding: base64",
"",
"WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY",
"WFhYWFhYWFhYDQo=",
"",
"-----=001_NextPart801803664644=---",
"Content-Type: text/html;",
" charset=\"ISO-8859-1\"",
"Content-Transfer-Encoding: quoted-printable",
"",
"<html><head><meta http-equiv=3D\"content-type\" content=3D\"text/html; charse=",
"t=3DISO-8859-1\"><style>bodyUnknown macro: { line-height}blockquote
Unknown macro: { margin-top}div.foxdiv201701161400456737=",
"13 { }bodyUnknown macro: { font-size}</style></head><body>=0A<div><span></span></div><blockquote=",
" style=3D\"margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;\"><div><=",
"div class=3D\"FoxDiv20170116140045673713\"><blockquote style=3D\"margin-top: =",
"0px; margin-bottom: 0px; margin-left: 0.5em;\"><div><div class=3D\"FoxDiv201=",
"70116133708224697\"><blockquote style=3D\"margin-top: 0px; margin-bottom: 0p=",
"x; margin-left: 0.5em;\"><div><div class=3D\"FoxDiv20170116132059834934\"><bl=",
"ockquote style=3D\"margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;=",
"\"><div><div class=3D\"FoxDiv20170116131842479478\"><blockquote style=3D\"marg=",
"in-top: 0px; margin-bottom: 0px; margin-left: 0.5em;\"><div><div class=3D\"F=",
"oxDiv20170116130934388968\"><blockquote style=3D\"margin-top: 0px; margin-bo=",
"ttom: 0px; margin-left: 0.5em;\"><div><div class=3D\"FoxDiv20170116130734603=",
"789\"><blockquote style=3D\"margin-top: 0px; margin-bottom: 0px; margin-left=",
": 0.5em;\"><div><div class=3D\"FoxDiv20170116130712731671\"><blockquote style=",
"=3D\"margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;\"><div><div cl=",
"ass=3D\"FoxDiv20170116130541763948\"><blockquote style=3D\"margin-top: 0px; m=",
"argin-bottom: 0px; margin-left: 0.5em;\"><div><div class=3D\"FoxDiv201701161=",
"24514335323\"><blockquote style=3D\"margin-top: 0px; margin-bottom: 0px; mar=",
"gin-left: 0.5em;\"><div><div class=3D\"FoxDiv20170116124321987400\"><blockquo=",
"te style=3D\"margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;\"><div=",
"><div class=3D\"FoxDiv20170116123422143022\"><blockquote style=3D\"margin-top=",
": 0px; margin-bottom: 0px; margin-left: 0.5em;\"><div><div class=3D\"FoxDiv2=",
"0170116123055868282\"><blockquote style=3D\"margin-top: 0px; margin-bottom: =",
"0px; margin-left: 0.5em;\"><div class=3D\"FoxDiv20170116115703081740\"><div><=",
"span style=3D\"font-size: 10.5pt; line-height: 1.5; background-color: windo=",
"w;\">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</sp=",
"an></div><blockquote style=3D\"margin-top: 0px; margin-bottom: 0px; margin-=",
"left: 0.5em;\"><div><div class=3D\"FoxDiv20170116112952258988\">=0A</div></di=",
"v></blockquote>=0A</div></blockquote>=0A</div></div></blockquote>=0A</div>=",
"</div></blockquote>=0A</div></div></blockquote>=0A</div></div></blockquote=",
">=0A</div></div></blockquote>=0A</div></div></blockquote>=0A</div></div></=",
"blockquote>=0A</div></div></blockquote>=0A</div></div></blockquote>=0A</di=",
"v></div></blockquote>=0A</div></div></blockquote>=0A</div></div></blockquo=",
"te>=0A</body></html>",
"-----=001_NextPart801803664644=-----",
"");Mail mail = FakeMail.fromMime(htmlMultipartRelatedMessagePart1 , javaCharset, javaMailCharset);
mailet.service(mail);
// assertThat(MailUtil.toString(mail, javaCharset)).isEqualTo("YWFhYWFhYWFhYmJiYmJiYg0K");
}
I try my best to solve, But i Don't know how to solve it.
If any advise will appreciation!
Attachments
Issue Links
- is superceded by
-
JAMES-2253 addFooter mailet doesn't work for multipart mail
- Closed