Examples of VacationData


Examples of com.mycompany.sample.vacation.VacationData

    Object exception;
    hc.setResult(PARAM_EXCEPTION, exception);
    */

    // {{*Handler implementation*
    VacationData data = (VacationData) hc.getParam(PARAM_DATA);

    String subject = "Your vacation request from " + data.getFromDate().toString() + " until " + data.getToDate().toString() + " has been ";
    if (data.getState() == VacationData.STATE_ACCEPTED)
    {
      subject += "granted.";
    }
    else
    {
      subject += "rejected - sorry.";
    }

    // Recipient's email ID needs to be mentioned.
    String to = data.getSubmitterEmail();

    // Sender's email ID needs to be mentioned
    String from = "me@mycompany.com";

    // Assuming you are sending email from localhost
    // TODO Specify your mail server here; we assume we do not need authentication for it.
    String host = "localhost";

    // Get system properties
    Properties properties = System.getProperties();

    // Setup mail server
    properties.setProperty("mail.smtp.host", host);

    // Get the default Session object.
    Session session = Session.getDefaultInstance(properties);

    try
    {
      // Create a default MimeMessage object.
      MimeMessage message = new MimeMessage(session);

      // Set From: header field of the header.
      message.setFrom(new InternetAddress(from));

      // Set To: header field of the header.
      message.addRecipient(Message.RecipientType.TO,
                 new InternetAddress(to));

      // Set Subject: header field
      message.setSubject("This is the Subject Line!");

      // Now set the actual message
      message.setText(data.getReason());

      // Send message
      Transport.send(message);
      System.out.println("Sent message successfully....");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.