Package eu.planets_project.ifr.core.common.mail

Examples of eu.planets_project.ifr.core.common.mail.PlanetsMailMessage


      log.warning(e.getMessage());
      return;
    }

    // Send them a message.
    PlanetsMailMessage mailer = new PlanetsMailMessage();
    mailer.setSubject(subject);
    mailer.setBody(body);
    mailer.addRecipient(user.getEmail());
    mailer.send();
  }
View Full Code Here


        // Look up the user.
        User user = UserBean.getUser(username);
        if( user == null ) return;
       
        // Create a message:
        PlanetsMailMessage message = new PlanetsMailMessage();
       
        // Add the recipient in properly.
        message.addRecipient(user.getFullName() + "<" + user.getEmail() + ">");
       
        // Determine the Testbed URL:
        // FIXME This is a HACK for the TB Service URL in emails:
        String testbedURL = "http://testbed.planets-project.eu/testbed/";
//        String testbedURL = "http://"+AdminManagerImpl.getAuthority()+"/testbed/";

        Map<String,Object> model = new HashMap<String,Object>();
        model.put("user", user);
        model.put("exp", exp);
        model.put("expName", exp.getExperimentSetup().getBasicProperties().getExperimentName());
        model.put("applicationURL", testbedURL);
       
        VelocityContext velocityContext;
        StringWriter result = new StringWriter();
        try {
            velocityContext = new VelocityContext(model);
            velocityEngine.mergeTemplate("eu/planets_project/tb/"+templateName+".vm", velocityContext, result);
        } catch  (VelocityException ex) {
            log.error("Mailing failed! :: "+ex);
            return;
        } catch  (RuntimeException ex) {
            log.error("Mailing failed! :: "+ex);
            return;
        } catch  (Exception ex) {
            log.error("Mailing failed! :: "+ex);
            return;
        }
        message.setSubject(velocityContext.get("subject").toString());
        message.setBody(result.toString());
       
        try {
            message.send();
        } catch( Exception e ) {
            log.error("An error occured while trying to send an email to "+user.getFullName()+"! :: "+e);
            e.printStackTrace();
        }
    }
View Full Code Here

   
    log.info("Sending email to: " + user.getEmail());
    log.info("Subject: " + subject);
    log.info(body);

    PlanetsMailMessage mailer = new PlanetsMailMessage();
                mailer.setSubject(subject);
                mailer.setBody(body);
                mailer.addRecipient(user.getEmail());
                //mailer.send();

    return "success";
  }
View Full Code Here

   
    log.info("Sending email to: " + user.getEmail());
    log.info("Subject: " + subject);
    log.info(body);

    PlanetsMailMessage mailer = new PlanetsMailMessage();
                mailer.setSubject(subject);
                mailer.setBody(body);
                mailer.addRecipient(user.getEmail());
                mailer.send();

    return "success";
  }
View Full Code Here

        UserManager um = UserBean.getUserManager();
        um.sendUserMessage(username, this.emailTestSubject, this.emailTestMessage)
        */
        try {
            // Send a message.
            PlanetsMailMessage mailer = new PlanetsMailMessage();
            //mailer.setSender("noreply@planets-project.eu");
            mailer.setSubject(this.emailTestSubject);
            mailer.setBody(this.emailTestMessage);
            mailer.addRecipient(this.emailTestAddress);
            mailer.send();
            this.setTestEmailResult("You email appears to have been successfully sent. Please check the logs.");
            log.info("Email sent successfully.");
        } catch( Exception e ) {
            this.setTestEmailResult("Sending email failed, with exception: "+e);
            log.info("Email sending failed.");
View Full Code Here

            TestbedManager testbedMan = (TestbedManager) JSFUtil.getManagedObject("TestbedManager");
            exp.getExperimentApproval().setState(Experiment.STATE_COMPLETED);
            exp.getExperimentExecution().setState(Experiment.STATE_IN_PROGRESS);
            testbedMan.updateExperiment(exp);
            //send email to helpdesk to inform them of approval
            PlanetsMailMessage mailer = new PlanetsMailMessage();
            mailer.setSender("noreply@planets-project.eu");
            mailer.setSubject("Testbed Experiment Deleted");
            mailer.setBody("Experiment "+exp.getExperimentSetup().getBasicProperties().getExperimentName()+" approved.");
            mailer.addRecipient("Helpdesktb@planets-project.eu");
            mailer.send();
            return "success";
        }
View Full Code Here

          // update in cached lists
          this.getExperimentsOfUser();
          this.getAllExperiments();
         
          //send email to exp contact to inform them of deletion
          PlanetsMailMessage mailer = new PlanetsMailMessage();
          mailer.setSender("noreply@planets-project.eu");
          mailer.setSubject("Testbed Experiment Deleted");
          mailer.setBody("Experiment "+expBean.getEname()+" deleted.");
          mailer.addRecipient(expBean.getEcontactemail());
          mailer.addCcRecipient("Helpdesktb@planets-project.eu");
          mailer.send();

        // go back to 'my experiments' page
        return "expDeleted";
      }
View Full Code Here

                //send email to admin
                String body = "Experiment deletion request received for experiment:\r\n";
                body += expName+"\r\n";
                body += "The contact for this experiment is "+contactName+" ("+contactEmail+")\r\n";
                //body += "Reason given for deletion: "+reason;
                  PlanetsMailMessage mailer = new PlanetsMailMessage();
                  mailer.setSender("noreply@planets-project.eu");
                  mailer.setSubject("Experiment deletion request: "+expName);
                  mailer.setBody(body);

                  User user = UserBean.getUser("admin");
                  mailer.addRecipient(user.getFullName() + "<" + user.getEmail() + ">");
                  mailer.send();
                 
                  //send email to user, explaining that they have *requested* deletion
                  body = "Experiment deletion request sent for experiment:\r\n";
                body += expName+"\r\n";
                body += "\r\nThe administrator will verify your request and delete the experiment if appropriate.";
                //body += "Reason given for deletion: "+reason;
                  mailer = new PlanetsMailMessage();
                  mailer.setSender("noreply@planets-project.eu");
                  mailer.setSubject("Experiment deletion request: "+expName);
                  mailer.setBody(body);

                  user = UserBean.getUser(experimenter);
                  mailer.addRecipient(user.getFullName() + "<" + user.getEmail() + ">");
                  mailer.send();
                 
                  log.info("Deletion request email sent successfully.");
              }
            } catch( Exception e ) {
                log.info("Deletion email sending failed. Details: "+ e);
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.common.mail.PlanetsMailMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.