CATEGORIES
Sending Email from JSP Pages Using smtp.gmail.com
Sample Codes for Sending Emails from JSP Page Using Gmail
Published by: San (9/4/2007)
How can I send emails from a jsp page? I have a page where i have a form and it sends out emails on submition. Please let me know the code and classes to include in jsp page to send emails.
This works for me. Try on your jsp page and if it doesn't work then post a comment here. Make sure to use the correct smtp server, user id and password. It can send text and html type of content so better comment and uncomment the codes on your wish.
String host="", user="", pass="";
host = smtp_server; //"smtp.gmail.com";
user = jsp_email; //"YourEmailId@gmail.com" // email id to send the emails
pass = jsp_email_pw; //Your gmail password
String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
String to = email_to_address; // out going email id
String from = email_from_address; //Email id of the recipient
String subject = email_subject;
String messageText = email_body;
boolean sessionDebug = true;
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol.", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setContent(messageText, "text/html"); // use setText if you want to send text
Transport transport = mailSession.getTransport("smtp");
transport.connect(host, user, pass);
try {
transport.sendMessage(msg, msg.getAllRecipients());
WasEmailSent = true; // assume it was sent
}
catch (Exception err) {
WasEmailSent = false; // assume it's a fail
}
transport.close();
Most Popular Articles
- Sending Email from JSP Pages Using smtp.gmail.com
- How to Configure 404 Error or Page not Found on Tomcat
- JSP Web Services Example - XML, XSLT in JSP - XML Web Services in Java
- How to Change the Image onMouseOver
- How to Email from JSP Page?
Javascript Change Image onMouseOver >>
<< JSP Web Services Example - XML, XSLT in JSP - XML Web Services in Java
COMMENT
Name: Pankaj
Hi I tried for code but it is giving an error
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.AuthenticationFailedException
please help me out................
PLease try to mail me ur suggestions at pvpatni@gmail.com
Name: goody
Thanks for that code.
Name: prem
how to know about the smtp server info?
Name: Anshul
its awesome...it worked soo easily..thnx..it solved my BIGGGGGG prob of triggering mail...
thanx...
Name: abdul
plz give proper step to use this code..i mean m nt getting were to pest this code..and how to use it...
Name: Vincent Lai
Pure Awesome, simple and sweet !
Name: Dumazzink
Where would be the most suitable place to put this code? In a Servlet?<br>
<br>
@prem - get the SMTP settings from the mailing server .. you must ask for it or see if it’s listed on their website. Some free email providers may not give you this information.
Name: Dumazzink
I’m getting an "javax.mail.AuthenticationFailedException" error - any help?
Name: Imran
Gr8 Thaks alot It works!
Name: Satheesh
hi i have been showing error at Session mailSession..
Name: kamini chaudhari
its very useful to me
thank u very much
Name: Sachin
Thank you very much, it helped me a lot.
Name: Chandan
thanks for the code .it helped me a lot.thanks
Name: Ravi
Hi there,
Thank you very much for this code. I was looking for this code for my project. i spent nearly 5 hrs on internet to find this code. once again thank you so much for this code
Name: Maxim Vasilkov at gmail
Works perfect!
Name: Vladimir
Works for me. Thank you.
Name: Muthu
Hi it’s working fine for me but use the following code
<%@ page import="java.io.*,java.util.*,javax.mail.*"%>
<%@ page import="javax.mail.internet.*,javax.activation.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%
String host="", user="", pass="";
host ="smtp.gmail.com"; //"smtp.gmail.com";
user =""; //"YourEmailId@gmail.com" // email id to send the emails
pass ="password"; //Your gmail password
String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
String to =""; // out going email id
String from =""; //Email id of the recipient
String subject ="welcome god";
String messageText ="welcome god";
boolean sessionDebug = true;
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol.", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setContent(messageText, "text/html"); // use setText if you want to send text
Transport transport = mailSession.getTransport("smtp");
transport.connect(host, user, pass);
try {
transport.sendMessage(msg, msg.getAllRecipients());
out.println("message successfully sended"); // assume it was sent
}
catch (Exception err) {
out.println("message not successfully sended"); // assume it’s a fail
}
transport.close();
%>
Name: charlyn
very helpful. it works!
Name: Ahmed Abd El-Rasoul
thanks ,it’s works :)
Name: neelam
thanks ,it’s works :)
Name: priya
thanx it works:)
Name: Santosh
Thank u very Much this code helped me a lot
Name: Arundev
This is not work for me.An error showing "Session cannot be resolved".What is the reason?
Name: mpoulhs
Muthu thanks a lot! :)
Name: hao
thanks u
Name: Ramesh.M
It is very useful for me. i have more example written but it is not working. This coding execute successfully.....
Name: Westley
Muthu it works and you saved me a day of work. Thanks
Name: Hitesh
Hello all,
i tried all the code you all suggested but it won’t worked for me Rather it gives me error below:
----
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
root cause
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
root cause
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
root cause
java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
root cause
java.security.UnrecoverableKeyException: Password must not be null
note The full stack traces of the exception and its root causes are available in the GlassFish/v3 logs.
GlassFish/v3
----
Any help is appreciated. Can anyone mail me solution @ hitesh.viradiya01@gmail.com
Thanks.
Name: ramprasanth A
<html>
<h1>
super its working for me dude thankss a lot
</h1>
</html>
Name: ali
hey thanx a ton it wrks!!!
Name: saksham
thanks
Name: vipin
relieved to have found a perfectly working code. Thanks
Name: pushparaj
muthu your are brillient it works , but i need with authentication for safer sending.
Name: rajjo singh
i am using kie workbench, i just created emailtask from service task from that assign the assignment to the appropriate field,i have set workitemhandler to email in" Deployment descriptor editor" in that i set host,username,password,port,tls as a false.
still i m getting error kindly plz tey to help me
Name: rajjio singh
at org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:78) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
... 107 more
19:17:03,040 ERROR [org.guvnor.common.services.backend.exceptions.ExceptionUtilities] (http-localhost/127.0.0.1:8080-5) Exception thrown: [Email.EmailWorkItemHandler:114 - Email:2] -- java.lang.RuntimeException: Unable to send email: org.jbpm.workflow.instance.WorkflowRuntimeException: [Email.EmailWorkItemHandler:114 - Email:2] -- java.lang.RuntimeException: Unable to send email
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:149) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:173) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:366) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:325) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:73) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:44) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:173) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:236) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:449) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:206) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:215) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:223) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1925) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.runtime.process.StartCorrelatedProcessCommand.execute(StartCorrelatedProcessCommand.java:146) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.runtime.process.StartCorrelatedProcessCommand.execute(StartCorrelatedProcessCommand.java:44) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:604) [drools-persistence-jpa-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:82) [drools-persistence-jpa-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73) [drools-persistence-jpa-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:397) [drools-persistence-jpa-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:559) [drools-core-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.kie.services.impl.ProcessServiceImpl.startProcess(ProcessServiceImpl.java:126) [jbpm-kie-services-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.services.cdi.impl.ProcessServiceCDIImpl$Proxy$_$$_WeldClientProxy.startProcess(ProcessServiceCDIImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-services-cdi-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl.startProcess(KieSessionEntryPointImpl.java:78) [jbpm-console-ng-business-domain-backend-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.startProcess(KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-business-domain-backend-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_151]
at org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:48) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:24) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.cdi.server.CDIExtensionPoints$2.callback(CDIExtensionPoints.java:396) [errai-weld-integration-3.0.6.Final-redhat-1.jar:3.0.6.Final-redhat-1]
at org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:296) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:97) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:114) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:142) [errai-bus-3.2.4.Final-redhat-1.jar:3.2.4.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source) [:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:264) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:262) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at javax.security.auth.Subject.doAsPrivileged(Subject.java:549) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:296) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:156) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:288) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:59) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.uberfire.ext.security.server.SecureHeadersFilter.doFilter(SecureHeadersFilter.java:69) [uberfire-servlet-security-0.9.0.Final-redhat-3.jar:0.9.0.Final-redhat-3]
at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source) [:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:264) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:262) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at javax.security.auth.Subject.doAsPrivileged(Subject.java:549) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:296) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:237) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:59) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.uberfire.ext.security.server.SecurityIntegrationFilter.doFilter(SecurityIntegrationFilter.java:57) [uberfire-servlet-security-0.9.0.Final-redhat-3.jar:0.9.0.Final-redhat-3]
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) [:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:264) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:262) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at javax.security.auth.Subject.doAsPrivileged(Subject.java:549) [rt.jar:1.8.0_151]
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:296) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:237) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:59) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_151]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
Caused by: org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException: java.lang.RuntimeException: Unable to send email
at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:55) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:38) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.workitem.email.EmailWorkItemHandler.executeWorkItem(EmailWorkItemHandler.java:88) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:69) [drools-persistence-jpa-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:139) [jbpm-flow-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
... 103 more
Caused by: java.lang.RuntimeException: Unable to send email
at org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:87) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:55) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
at org.jbpm.process.workitem.email.EmailWorkItemHandler.executeWorkItem(EmailWorkItemHandler.java:82) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
... 105 more
Caused by: java.lang.RuntimeException: Connection failure
at org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:81) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
... 107 more
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1960) [mail-1.4.5.redhat-2.jar:1.4.5.redhat-2]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642) [mail-1.4.5.redhat-2.jar:1.4.5.redhat-2]
at javax.mail.Service.connect(Service.java:295) [mail-1.4.5.redhat-2.jar:1.4.5.redhat-2]
at org.jbpm.process.workitem.email.SendHtml.sendHtml(SendHtml.java:78) [jbpm-workitems-6.5.0.Final-redhat-2.jar:6.5.0.Final-redhat-2]
... 107 more