Portal Mailing API

From Gcube Wiki
Revision as of 16:10, 3 May 2016 by Massimiliano.assante (Talk | contribs) (Example of Email Sending)

Jump to: navigation, search

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();