diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 3665ef0..7397c4c 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -6,7 +6,7 @@ uses - + uses diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/EmailNotification.java b/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/EmailNotification.java deleted file mode 100644 index 8f49f3d..0000000 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/EmailNotification.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.gcube.portlets.user.gcubeloggedin.server; - -import java.util.Date; -import java.util.Properties; - -import javax.mail.Address; -import javax.mail.Message; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; - -import org.apache.log4j.Logger; - -/** - * A class for sending email - * - * @author Panagiota Koltsida, NKUA - * - */ -public class EmailNotification { - - /** - * The sender of the email - */ - private String emailSender; - - /** - * The recipients of the email - */ - private String emailrecipients[]; - - /** - * Email's subject - */ - private String emailSubject; - - /** - * Email's body message - */ - private String emailBody; - - /** Logger */ - private static Logger logger = Logger.getLogger(EmailNotification.class); - - /** - * Class's constructor - * - * @param sender - * @param recipients - * @param subject - * @param body - */ - public EmailNotification(String sender, String recipients[], String subject, String body) { - this.emailSender = sender; - this.emailrecipients = recipients; - this.emailSubject = subject; - this.emailBody = body; - } - - public void sendEmail() { - Properties props = System.getProperties(); - String mailServiceHost = "localhost"; - props.put("mail.smtp.host", mailServiceHost); - String mailServicePort = "25"; - props.put("mail.smtp.port", mailServicePort); - Session session = Session.getDefaultInstance(props, null); - session.setDebug(true); - Message mimeMessage = new MimeMessage(session); - - try { - // EMAIL SENDER - Address from = new InternetAddress(emailSender); - mimeMessage.setFrom(from); - - // EMAIL RECIPIENTS - for (int i=0; i adminEmails = getAdministratorsEmails(scope); UserManager um = new LiferayUserManager(); GCubeUser currUser = null; @@ -250,17 +253,12 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi body.append("
"); body.append("e-mail: " + currUser.getEmail()); body.append("

"); - body.append("

"); - body.append("WARNING / LEGAL TEXT: This message is intended only for the use of the individual or entity to which it is addressed and may contain"+ - " information which is privileged, confidential, proprietary, or exempt from disclosure under applicable law. " + - "If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, you are strictly prohibited from disclosing, distributing, copying, or in any way using this message."); - body.append("

"); String[] allMails = new String[adminEmails.size()]; adminEmails.toArray(allMails); - EmailNotification mailToAdmin = new EmailNotification("no-reply@d4science.org", allMails , "[" + gatewayName + "] - unregistration from VRE", body.toString()); + EmailNotification mailToAdmin = new EmailNotification(allMails , "unregistration from VRE", body.toString(), getThreadLocalRequest()); mailToAdmin.sendEmail(); }