在Jasperserver的预定报告中发送电子邮件正文中的HTML内容 [英] Sending HTML content in the email body in Jasperserver's scheduled reports

查看:399
本文介绍了在Jasperserver的预定报告中发送电子邮件正文中的HTML内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JasperServer中生成报告并使用Rest api来安排报告。其余的api如下:

I'm generating the reports in JasperServer and using the Rest api to schedule the report. The rest api is given below:

 curl 
    -XPUT "http://hostURL/jasperserver/rest_v2/jobs" 
    --data '{
            "trigger":{
                "simpleTrigger":{
                    "occurrenceCount":"1",
                    "startType":"1",
                    "timezone":"Asia/Calcutta",
                    "misfireInstruction":"0",
                    "version":"0"
                }
            },
            "outputTimeZone":"Asia/Calcutta",
            "username":"jasperadmin",
            "outputFormats":{
                "outputFormat":[
                    "PDF"
                ]
            },
            "source":{
                "parameters":{
                    "parameterValues":{
                        "parameter1":[
                            "value"
                        ],
                        "parameter2":[
                            "value"
                        ],
                    }
                },
                "reportUnitURI":"/reports/Report"
            },
            "baseOutputFilename":"MyReport",
            "mailNotification":{
            "messageText":"<p> Greeting,<br>Please find your statements.<p>",
                "toAddresses":{
                    "address":[
                        "myemail@xyz.com"
                    ]
                },
                "includingStackTraceWhenJobFails":"false",
                "skipEmptyReports":"false",
                "subject":"Account Statement",
                "skipNotificationWhenJobFails":"false",
                "resultSendType":"SEND_ATTACHMENT"
            },
            "repositoryDestination":{
                "usingDefaultReportOutputFolderURI":"false",
                "folderURI":"/Reports/GeneratedReports",
                "saveToRepository":"true",
                "overwriteFiles":"true",
                "sequentialFilenames":"false"
            },
            "label":"Report_20160929591135"

        }' 
    -H "authorization:Basic amFzcGVyYWRtaW46amFzcGVyYWRtaW4=" 
    -H "content-type:application/job+json"

API完美运行。但是我在 messageText 中发送的HTML内容不会呈现并显示为纯字符串。有什么方法可以在 messageText 中发送HTML内容。我是否必须在某些属性文件中进行更改?

The API works perfectly. But the HTML content that I send in the messageText is not rendered and shows up as plain string. Is there any way I could send HTML content in the messageText. Do I have to make changes in some property files?

推荐答案

据我所知,Jaspersoft Server无法发送HTML电子邮件,因为它使用的是基本的Java字符串。

As far as I know, Jaspersoft Server is not capable of sending HTML Emails as it is using basic Java Strings.

您基本上必须编辑源代码并根据自己的喜好进行更改。

You basically have to edit the source code and change it to your liking.

对于换行符,可能只是使用 \ n

For the line breaks maybe just use \n ?

这篇关于在Jasperserver的预定报告中发送电子邮件正文中的HTML内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆