[logback-user] SMTPAppender - Email not formatted properly when log message contains double linebreak
Mads Bondo Dydensborg
mbd at dbc.dk
Mon Jun 24 15:31:03 CEST 2013
The stmp standard dictates that a header field is terminated by a new line. An empty line terminates the list of header fields.
The relevante info is in 3.1.3 of the 822 RC, I guess:
3.1.3. UNSTRUCTURED FIELD BODIES
For some fields, such as "Subject" and "Comments", no struc-
turing is assumed, and they are treated simply as <text>s, as
in the message body. Rules of folding apply to these fields,
so that such field bodies which occupy several lines must
therefore have the second and successive lines indented by at
least one LWSP-char.
So, it looks like a bug in the SMTP appender or some software it uses.
Regards
Mads
Mandag 24 juni 2013 13:00:46 skrev Arend v. Reinersdorff:
Hi,
when I a log message with a double linebreak "A\n\nA" to SMTPAppender, the resulting Email is not formatted properly.
The MIME parts are not parsed but are display as the message body. It looks like the double linebreak is written directly into the Subject-Header.
With a single linebreak I get the same problem in Gmail. In Outlook the email is formatted properly, only the subject is cut at the linebreak.
Could this be a bug in Logback?
Regards,Arend
Logging call:LoggerFactory.getLogger(Main.class).error("A\n\nA");
logback.xml:<configuration> <root> <appender class="ch.qos.logback.classic.net.SMTPAppender"> <smtpHost>... smtpHost</smtpHost> <to>... email</to> <subject>%logger{10} - %message</subject> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%logger{10} - %message</pattern> </layout> </appender> </root></configuration>
Email subject:c.e.l.Main - A
Visible email body:
AMIME-Version: 1.0Content-Type: multipart/mixed; boundary="----=_Part_0_14393847.1372070958822"
------=_Part_0_14393847.1372070958822Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 7bit
c.e.l.Main - AA------=_Part_0_14393847.1372070958822--
Email source:
... email headers
To: ...Message-ID: ...Subject: c.e.l.Main - A
AMIME-Version: 1.0Content-Type: multipart/mixed; boundary="----=_Part_0_14393847.1372070958822"
------=_Part_0_14393847.1372070958822Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 7bit
c.e.l.Main - AA------=_Part_0_14393847.1372070958822--
--
Med venlig hilsen/Regards
Chefarkitekt/Chief Architect cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 29 84 00 42
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130624/5eefa20c/attachment.html>
More information about the Logback-user
mailing list