I am trying to send mail using Aem 6.1. The functionality works correct in when inbuilt jetty server is used. But when the same is deployed on weblogic 12c, it fails with java.lang.linkage error.
There is a article on helpx.adobe.com knowledge base which also acknowledges the issue but it didnt work for me - https://helpx.adobe.com/experience-manager/kb/using-java-mail—java-activation-with-weblogic.html
Is there is a more detailed documentation available on the exact steps to be done to resolve the issue?
Regards,
Anil
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Anil,
Check this article with Java mail API: https://helpx.adobe.com/experience-manager/using/creating-custom-cq-email-services.html
Thanks,
Ratna Kumar.
Views
Replies
Total Likes
To send email from AEM, write an OSGi bundle that uses Java Mail API and you can send email. Now having said that - there may be libs that you need to deploy in bundle fragments to get an OSGi bundle using Java mail API working.
Views
Replies
Total Likes
Hi Anil Kumar
As correctly mentioned by Scott, that you may write an OSGI bundle and can call it using Sling servlet or as a Service. Please have a look at the code below:-
String to = "sonoojaiswal1988@gmail.com";//change accordingly
String from = "sonoojaiswal1987@gmail.com";change accordingly
String host = "localhost";//or IP address
//Get the session object
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
Session session = Session.getDefaultInstance(properties);
//compose the message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
message.setSubject("Ping");
message.setText("Hello, this is example of sending email ");
// Send message
Transport.send(message);
System.out.println("message sent successfully....");
You may use this code in doPost/doGet methods of OSGi when using it as Sling Servlet else you can use in some method of OSGI class and can invoke from JSP when using it as OSGI service.
I hope this will help you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Thanks, our code is very similar to what you suggested. Have you tried executing this on RHEL 6.6 and WLS12c?
Views
Replies
Total Likes
Then why the special knowledge base on the helpx.adobe,com was required???
Views
Replies
Total Likes
Hi Anil,
Check this article with Java mail API: https://helpx.adobe.com/experience-manager/using/creating-custom-cq-email-services.html
Thanks,
Ratna Kumar.
Views
Replies
Total Likes
which version of java activation are you using ?? Also can you give more details on your JRE , AEM versions ?
Views
Replies
Total Likes
AEM is 6.1 and JRE is 1.7. I can provide you the exact information in couple of hours. Is there any specific information you are looking for about java activation?
I tried sending mail using a servlet deployed on the same weblogic and the mails were being sent correctly.
Views
Replies
Total Likes
Views
Likes
Replies