내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Send mail from AEM6.1 using Weblogic as application server

Avatar

Level 4

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

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 10
7 답변 개

Avatar

Level 10

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. 

Avatar

Administrator

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



Kautuk Sahni

Avatar

Level 4

Thanks, our code is very similar to what you suggested. Have you tried executing this on RHEL 6.6 and WLS12c?

Avatar

Level 4

Then why the special knowledge base on the helpx.adobe,com was required???

Avatar

정확한 답변 작성자:
Level 10

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.

Avatar

Level 10

which version of java activation are you using ?? Also can you give more details on your JRE , AEM versions ?

Avatar

Level 4

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.