简体   繁体   中英

Email not sent in Jasper Report Scheduling

I want to schedule my jasper report so that at a particular time, it will send the report to the mentioned id. I'm using Jasper Server 4.5.0 and I have scheduled a sample report to be sent to my gmail id. However, it's not been sent to the mail id and it doesn't show any Last Ran time too.

I found it hard to setup GMail as my email server. So once I got it working I posted the details in this article .

In the spirit of keeping StackOverflow answers self-contained, here are the key settings. js.quartz.properties:

report.scheduler.web.deployment.uri=http://localhost/jasperserver
report.scheduler.mail.sender.host=smtp.gmail.com
report.scheduler.mail.sender.username=me@gmail.com
report.scheduler.mail.sender.password=mypassword
report.scheduler.mail.sender.from=me@gmail.com
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=587

applicationContext-report-scheduling.xml:

<property name="javaMailProperties">
    <props>
        <prop key="mail.smtp.auth">true</prop>  <!--as indicated in JasperReports-Server-Install-Guide.pdf)-->
        <prop key="mail.smtp.starttls.enable">true</prop>  <!--NOT indicated in JasperReports-Server-Install-Guide.pdf-->
    </props>
</property>

One observation,

If you´re going to use an email from Microsoft Exchange, you need on more line in the applicationContext-report-scheduling.xml

  <props> <prop key="mail.smtp.auth">true</prop> <prop key="mail.smtp.starttls.enable">true</prop> <prop key="mail.smtp.starttls.required">true</prop> </props> 

in my case works with this

first edit this arquive

/opt/jasperreports-server-cp-5.1.0/apache-tomcat/webapps/jasperserver/WEB-INF/js.quartz.properties

report.scheduler.mail.sender.host=smtp.gmail.com
report.scheduler.mail.sender.username=username@gmail.com
report.scheduler.mail.sender.password=your_password
report.scheduler.mail.sender.from=username@gmail.com
report.scheduler.mail.sender.protocol=smtps
report.scheduler.mail.sender.port=465

second edit this

opt/jasperreports-server-cp-5.1.0/apache-tomcat/webapps/jasperserver/WEB-INF/applicationContext-report-scheduling.xml

<bean id=”reportSchedulerMailSender”>
<property name=”host” value=”${report.scheduler.mail.sender.host}”/>
<property name=”username” value=”${report.scheduler.mail.sender.username}”/>
<property name=”password” value=”${report.scheduler.mail.sender.password}”/>
<property name=”protocol” value=”${report.scheduler.mail.sender.protocol}”/>
<property name=”port” value=”${report.scheduler.mail.sender.port}”/>
<property name=”javaMailProperties”>
<props>
    **<prop key=”mail.smtps.auth”>true</prop>
    <prop key=”mail.smtps.starttls.enable”>true</prop>**
</props>
</property>
</bean>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM