Can't send email with jasper report from jasper server - email

I am unable to send email with jasper report using jasper server. I tried the following configuration,
js.quartz.properties
report.scheduler.mail.sender.host=smtp.gmail.com
report.scheduler.mail.sender.username=xxx#gmail.com
report.scheduler.mail.sender.password=xxxx
report.scheduler.mail.sender.from=xxx#gmail.com
report.scheduler.mail.sender.protocol=smtps
report.scheduler.mail.sender.port=465
Also tried this way too,
report.scheduler.mail.sender.host=smtp.gmail.com
report.scheduler.mail.sender.username=xxx#gmail.com
report.scheduler.mail.sender.password=xxxx
report.scheduler.mail.sender.from=xxx#gmail.com
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=587
applicationContext-report-scheduling.xml
<bean id="reportSchedulerMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<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.smtp.auth">true</prop>
<prop key="mail.smtps.starttls.enable">true</prop>
</props>
</property>
</bean>
Also I have made Allow less secure apps: ON for my google account.
Given below is the stack trace shown in View -->Messages
Subject:
The job failed to execute. Review its parameters.
Date:
Today
Component:
Report Scheduler
Message:
Job: Test 6 (ID: 922871) Report unit: /Report/Daily_Collection_Report Quartz Job: ReportJobs.job_922871 Quartz Trigger: ReportJobs.trigger_922867_0 Exceptions: The job error notification was not completed. An error occurred while sending it. org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError v67sm3191899pfb.45 - gsmtp ; message exception details (1) are: Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError v67sm3191899pfb.45 - gsmtp at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:416) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJobMailNotificationImpl.sendMailNotification(ReportExecutionJobMailNotificationImpl.java:135) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.sendMailNotification(ReportExecutionJob.java:974) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(ReportExecutionJob.java:570) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:220) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) fail to send out alert mail notification org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError m19sm3330229pff.108 - gsmtp ; message exception details (1) are: Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError m19sm3330229pff.108 - gsmtp at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:416) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJobAlertImpl.sendAlertMail(ReportExecutionJobAlertImpl.java:102) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.sendAlertMail(ReportExecutionJob.java:615) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(ReportExecutionJob.java:595) at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:220) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Please advice on how to configure jasper so that I can send emails.
Thank you!

Related

How to set SMTP Office365 mail configuration in WSO2 Product

we are trying to set SMTP Mail configuration in WSO2 Product. Following steps for set SMTP Mail Configuration in WSO2BPMN Product.
Change SMTP Configuration in /conf/activiti.xml
<property name="mailServerHost" value="smtp.office365.com"/>
<property name="mailServerPort" value="587"/>
<property name="mailServerDefaultFrom" value="XXX#YYY.COM"/>
<property name="mailServerUseTLS" value="true"/>
<property name="mailServerUsername" value="XXX#YYY.COM"/>
<property name="mailServerPassword" value="XXX"/>
Restart Wso2BPMN product to apply changes in wso2bpmn.
But, we are facing the issue in send mail from Office365 through wso2bpmn product. Here, I have addressed the issue below,
Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1398)
at org.apache.commons.mail.Email.send(Email.java:1423)
at org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior.execute(MailActivityBehavior.java:102)
... 192 more
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:780E0000, 17.43559:0000000094000000000000000000000000000000, 20.52176:140F9185000010100A00D231, 20.50032:140F9185701710100A00E231, 0.35180:62350000, 255.23226:0A00C931, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 16.55847:B2000000, 17.43559:0000000068010000000000000200000000000000, 20.52176:140F9185000010107B350000, 20.50032:140F91857017101080350000, 0.35180:0A00D330, 255.23226:85350000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:8F350000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A007530, 0.37692:04000100, 0.37948:04000100, 5.33852:00000000534D545000040480, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:DD08C5FEDCC4AE4D81EB3D16E07C62BF00000000, 5.10786:0000000031352E32302E313432352E3030303A414D30505230374D42353436303A65353332653963312D613162352D343633372D383933632D35393263323535396364343300000000000000, 255.1750:2A310000, 255.31418:0A003F32, 0.22753:2F310000, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A009530, 4.30158:DC040000 [Hostname=AM0PR07MB5460.eurprd07.prod.outlook.com]
Please Provide me with any suggestion/idea for this.
Thanks,
Vivek KT.
the same thing happened to me. In my case, the problem is that I have never entered with that email account and it has not been configured. once configured it has worked well for me.
first connect to outlook.com and set up the account and then try wso2.
And i put all that email information in conf/axis2/axis2.xml

Wso2 EI 6.1.1 + third party rest api integration

I'm unable to call third party rest api(https://api.github.com/users/hackeryou) in wso2 ei and wso2 esb.
Below is the sample code:
<api xmlns="http://ws.apache.org/ns/synapse" name="VerifyCustID" context="/mambu">
<resource methods="GET" uri-template="/verify">
<inSequence>
<log>
<property name="CustID API" value="*********Inside CustID API********** "/>
</log>
<send>
<endpoint>
<http method="GET" uri-template="https://api.github.com/users/hackeryou"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>
Below is the error in server log:
ID API = *********Inside CustID API**********
[2017-07-14 15:01:48,756] [] WARN - ConnectCallback Connection refused or failed for : api.github.com/192.30.253.116:443
[2017-07-14 15:01:48,759] [] WARN - EndpointContext Endpoint : AnonymousEndpoint with address https://api.github.com/users/hackeryou will be marked S
USPENDED as it failed
[2017-07-14 15:01:48,760] [] WARN - EndpointContext Suspending endpoint : AnonymousEndpoint with address https://api.github.com/users/hackeryou - cur
rent suspend duration is : 30000ms - Next retry after : Fri Jul 14 15:02:18 IST 2017
[2017-07-14 15:01:48,772] [] INFO - LogMediator To: https://api.github.com/users/hackeryou, MessageID: urn:uuid:7b834e0e-e348-4b60-adeb-f60a70f00483,
Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 101503, ERROR_MESSAGE = Error connecting to the back end, Envelope: <?
xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
You might have some network connectivity issue to api.github.com:443 (perhaps firewalls etc.)
The API worked fine for me on EI611:
If you are not using the default truststore (client-truststore.jks) that comes with WSO2 or have made changes to it, you might need to import the certificate for api.github.com into the trust store that your WSO2 server is actually using.
Apart from network connectivity and missing certificate in trust store, can't see why your API shouldn't be able to call the remote service

Proxy service run through scheduled task in wso2 esb is giving error "Unexpected error sending message back"

We have created a proxy service in wso2 esb using esb poject in eclipse. This proxy service is invoking 2 web services, first one query data from legacy system and the other one creates sale order in oracle fusion.
This proxy service when run from soap ui executes successfully and creates sale order with no error. While when when run from scheduled task, it runs and creates order but gives error "Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender}" in wso2carbon.log file.
The xml for scheduled task is as follows
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="testtask2">
<trigger count="1" interval="60"/>
<property name="proxyName" value="EslSfaOFAOMSOIntegrationPS" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="soapAction" value="operation" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="to"
value="http://10.1.6.176:8280/services/EslSfaOFAOMSOIntegrationPS.EslSfaOFAOMSOIntegrationPSHttpSoap11Endpoint" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<soapenv:Envelope xmlns:esl="esl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<esl:operation/>
</soapenv:Body>
</soapenv:Envelope>
</property>
</task>
The complete error log is as follows
TID: [-1234] [] [2017-02-23 06:19:17,471] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Connection:keep-alive,Content-Language:en,Content-Length:0,Content-Type:,Date:Thu, 23 Feb 2017 06:19:17 GMT,Server:Oracle-Application-Server-11g,Set-Cookie:<oracle fusion url>; httponly; secure; path=/,X-ORACLE-DMS-ECID:005IImNkZMq3z005RzH7id0001U70002LZ,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: Transport out has not been set
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:432)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:222)
at org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:35)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:260)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Put <property name="OUT_ONLY" value="true"/> inside your EslSfaOFAOMSOIntegrationPS proxy.
And I think you can remove to property since the message is sent to proxy given in proxyName property.

JasperReport Server email by Sendgrid

When trying to send email from JasperReport Server using Sendgrid it throws error
2016-05-22 05:27:20,212 ERROR ReportExecutionJob,quartzScheduler_Worker-1:349 - The job error notification was not completed. An error occurred while sending it. org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 Unauthenticated senders not allowed ; message exception details (1) are: Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 550 Unauthenticated senders not allowed
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:416)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJobMailNotificationImpl.sendMailNotification(ReportExecutionJobMailNotificationImpl.java:139)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.sendMailNotification(ReportExecutionJob.java:1059)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(ReportExecutionJob.java:570)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:241)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Though username and password works, Is it possible to send mail using Sendgrid in JasperServer? It was tried using below configuration.
report.scheduler.mail.sender.host=smtp.sendgrid.net
report.scheduler.mail.sender.username=*****
report.scheduler.mail.sender.password=******
report.scheduler.mail.sender.from=no-reply#stutzen.me
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=2525
Need a additional configuration in
/jasperserver/WEB-INF/applicationContext-report-scheduling.xml
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.sendpartial">true</prop>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
mail.smtp.auth needs to be true for Sendgrid

AnonymousEndpoint When send email in WSO2 ESB

When I Try a service which send message to an email, It send 1 message each 30sec 3 or 4 times. The error message is:
Suspending endpoint : AnonymousEndpoint - last suspend duration was :
30000ms and current suspend duration is : 30000ms
Why endpoint is marked like anonumousEndpoint if the message arrive to receiver?
Solution is adding this line before :
<header name="To" action="remove"></header>
<property name="RESPONSE" value="true" scope="default" type="STRING"></property>