如何在我的GSP中显示MIME内容

时间:2014-04-16 13:31:50

标签: java email grails javamail grails-plugin

我正在阅读邮件

除非我尝试阅读包含MIME内容的邮件

,否则一切正常

这就是我显示邮件内容的方式

<table>
  <tr>
    <td>
      ${emailInstance.body}
    </td>
  </tr>
</table>

这就是它的显示方式

This is a multi-part message in MIME format. --------------050707070509090302050506 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit --------------050707070509090302050506 Content-Type: message/rfc822; name="MSTD Status 20th Mar 2014 @08:00 PM EST: =?windows-1252?Q?Martinsburg=97G?==?windows-1252?Q?reen/Portland=97Green/Goodyear=97Green=2Eeml?=" Content-Disposition: inline; filename*0*=windows-1252''%4D%53%54%44%20%53%74%61%74%75%73%20%32%30%74%68; filename*1*=%20%4D%61%72%20%32%30%31%34%20%40%30%38%3A%30%30%20%50%4D%20; filename*2*=%45%53%54%3A%20%4D%61%72%74%69%6E%73%62%75%72%67%97%47%72%65; filename*3*=%65%6E%2F%50%6F%72%74%6C%61%6E%64%97%47%72%65%65%6E%2F%47%6F; filename*4*=%6F%64%79%65%61%72%97%47%72%65%65%6E%2E%65%6D%6C Content-Transfer-Encoding: 7bit X-Mozilla-Keys: Message-ID: <532B80F4.1090401@spi.com> Date: Fri, 21 Mar 2014 05:29:48 +0530 From: Hussain Akhtar Wahid User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: sivaraman.mattipalli@macys.com, saravana.elayaperumal@macys.com, venkat.davuluri@macys.com, vani.rao@macys.net CC: d2csupport@spi.com, SPI_D2C_WMS_SUPPORT@MACYS.com Subject: =?windows-1252?Q?MSTD_Status_20th_Mar_2014_=4008=3A00_?= =?windows-1252?Q?PM_EST=3A_Martinsburg=97Green/Portland=97Green/Good?= =?windows-1252?Q?year=97Green?= Content-Type: multipart/alternative; boundary="------------050503030807080405060907" This is a multi-part message in MIME format. --------------050503030807080405060907 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Hi All, Please find the MST Dashboard for D2C Applications on 20th March 2014. Notes: A. This dashboard is of 08:00PM EST. B. Martinsburg , Portland and Goodyear status are listed on the dashboard. Thanks and regards , Hussain A W . --------------050503030807080405060907 Content-Type: multipart/related; boundary="------------030304090406050502010103" --------------030304090406050502010103 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi All,

但它应该显示为

enter image description here

1 个答案:

答案 0 :(得分:0)

您是否在Grails Config.groovy`文件中设置了所有要求。请确保以下内容:

grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
                      xml: ['text/xml', 'application/xml'],
                      text: 'text/plain',
                      js: 'text/javascript',
                      rss: 'application/rss+xml',
                      atom: 'application/atom+xml',    
                      css: 'text/css',
                      csv: 'text/csv',
                      all: '*/*',
                      json: ['application/json','text/json'],
                      form: 'application/x-www-form-urlencoded',
                      multipartForm: 'multipart/form-data',
                      multipartForm: 'multipart/alternative', //in your case
                                             add other MIME types as nessary
                      manifest: 'text/cache-manifest' 
   ]        

并尝试在web.xml上添加此内容

<mime-mapping>
    <extension>manifest</extension>
    <mime-type>text/cache-manifest</mime-type>
</mime-mapping>