Difference between revisions of "Portal Mailing API"

From Gcube Wiki
Jump to: navigation, search
(Created page with "__FORCETOC__ === Introduction === The gCube Portal Manager is a component all portlets need to use to get the context where they are running into. Moreover, passing an HttpSe...")
 
(Example of Email Sending)
Line 22: Line 22:
 
EmailNotification email2Send = new EmailNotification(String recipient, String subject, String body, HttpServletRequest httpServletRequest);
 
EmailNotification email2Send = new EmailNotification(String recipient, String subject, String body, HttpServletRequest httpServletRequest);
  
or  
+
//or  
  
 
EmailNotification(List<String> recipients, String subject, String body, HttpServletRequest httpServletRequest);
 
EmailNotification(List<String> recipients, String subject, String body, HttpServletRequest httpServletRequest);
  
then
+
//then
  
 
email2Send.sendEmail();
 
email2Send.sendEmail();

Revision as of 16:10, 3 May 2016

Introduction

The gCube Portal Manager is a component all portlets need to use to get the context where they are running into. Moreover, passing an HttpServletRequest object to its methods, you can also use it for sending emails on behalf of the portal you are using:

Maven Dependency

In order to use it in your project, add the following dependency to the project's pom.xml file

<dependency>
	<groupId>org.gcube.common.portal</groupId>
	<artifactId>portal-manager</artifactId>
	<scope>provided</scope>
</dependency>

Example of Email Sending

import org.gcube.common.portal.mailing;
import javax.servlet.http.HttpServletRequest;
...
 
EmailNotification email2Send = new EmailNotification(String recipient, String subject, String body, HttpServletRequest httpServletRequest);
 
//or 
 
EmailNotification(List<String> recipients, String subject, String body, HttpServletRequest httpServletRequest);
 
//then
 
email2Send.sendEmail();