SMTPAppender, HTMLLayout with text/plain

Hi. For some reason I'm receiving email reports with mime type text/plain and my email client shows all the html code. I'm attaching a report sent by logback. I'm using javax.mail 1.4.4 and this logback (1.0.3) configuration <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="5000"> <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>../logs/sama.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <appender name="mail" class="ch.qos.logback.classic.net.SMTPAppender"> <smtpHost>mail.ipb.pt</smtpHost> <to>filipe@ipb.pt</to> <from>noreply@ipb.pt</from> <subject>[sama]: %logger{20} - %m</subject> <layout class="ch.qos.logback.classic.html.HTMLLayout" /> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>WARN</level> </filter> </appender> <logger name="org.eclipse.jetty" level="WARN" /> <logger name="org.apache.cxf" level="WARN"/> <logger name="pt.ipb.sama" level="WARN" /> <root level="WARN"> <appender-ref ref="file" /> <appender-ref ref="mail"/> </root> </configuration> Thanks -- Filipe Sousa

Filipe Sousa <natros@...> writes:
Hi.
For some reason I'm receiving email reports with mime type text/plain and my email client shows all the html code. I'm attaching a report sent by logback.
I'm using javax.mail 1.4.4 and this logback (1.0.3) configuration
I had the same problem and just found the explanation: I had a (not direct) dependency to geronimo-javamail_1.4_spec and this implementation was used and it forces the content-type to 'text/plain' (http://grepcode.com/file/repo1.maven.org/maven2/org.apache.geronimo.specs/ge...) So just exclude 'geronimo-javamail_1.4_spec' and it should solve your problem.
participants (2)
-
Alexandre Garnier
-
Filipe Sousa